How to use special mail tag [_post_id] in hook before_send_mail
-
Here’s what I want to accomplish:
I have a page with contact form.
I want to get the post id of the page and include that data in the mail using the hook before send:function modify_wpcf7_before_send_mail ( $components, $number ) {
$components[ ‘body’ ] .= get_the_ID();
return $components;}
add_action(“wpcf7_mail_components”,’modify_wpcf7_before_send_mail’, 10, 2 );Replacing the subject and recipient works for me but getting the post id is giving me an empty value.
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘How to use special mail tag [_post_id] in hook before_send_mail’ is closed to new replies.