Contact Form 7 – Editing email output of tags

Have you ever needed to make small changes to the output that Contact Form 7 creates for emails? Change a certain word, replace certain characters, etc.? Well here’s the solution:

add_filter('wpcf7_mail_tag_replaced', tag_replace_function(), 10, 3);

Now, this is not a perfect solution, it’s fairly brutish in fact. CF7 did not see it fit to provide you with many avenues for editing the mail output. This filter only provides you with the following information:

  • The replaced text ($replaced)
  • The original values ($submitted)
  • Whether or not is it HTML ($html)

Using this information you can’t do a whole lot, unless you want some really broad changes.… Read the rest