Send email to WordPress post author and CF7

Today I will tell you how I coped with one interesting task.. The client had an article with several authors and each author had to receive letters from their own articles. To solve this problem, we registered a separate account for each author and indicated the authors' emails.

Next was the task in the popular plugin Contact form 7 ( CF7 ) add email of the author of the current article or from the author's page. After not much more brainstorming, a dozen cups of coffee drunk and google searches i found the solution. As always, the problem was solved quite simply., like everything in wordpress. To display the dynamic address of the contact form plugin, I used an additional plugin Contact Form 7 Dynamic Text Extension, with it, I was able to easily pass a dynamic value to one of the form fields.

Consider the steps of sending emails to the author of the post using the Contact Form plugin 7 (Cf7)

  1. Installing Contact Form plugins 7 и Contact Form 7 Dynamic Text Extension and create a new contact form with CF7 plugin.
  2. Add any required fields to the form and be sure to add a hidden dynamic field as shown below. Name the dynamic field custom-post-author-email-short-code and in the Dynamic value field add the name of the short code CUSTOM_POST_AUTHOR_EMAIL!Отправить письмо автору поста WordPress и CF7
    Adding dynamic email to contact form 7
  3. Now click on the Mail tab of the CF7 form and fill in the "Email to" field using the shortcode: [custom-post-author-email-shortcode]. With this setting, we achieve, to have our contact form send a message to our dynamically generated email address.
  4. Registrable shortcode, to get the email address of the current post author. We are creating a new shortcode for this job using the WordPress Shortcode API! You can put the code in a new plugin or in your functions.php file:
With this simple shortcode, you get the post author's email address and return it as a shortcode value. Hope, what did it save you time, which I spent, while looking for a solution. Good clients and quick problem solving.


Buy WordPress hosting
WordPress tutor
Online tutoring services. List of courses I teach
  • Basic web design course;
  • Site layout;
  • General course on CMS WordPress and continuation of the course on template development;
  • Website development in PHP.
Read more on the page WordPress tutor
*/

Nikolaenko Maxim

Director of web studies ProGrafika. I am developing, website design and promotion. Always glad to new blog readers and good clients.


You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Templates for WordPress
The best hosting in Ukraine
Stable hosting for Drupal