Jonny MacEachern on "[Plugin: Contact Form 7] Dynamic recipient using custom field"

ساخت وبلاگ

Jonny MacEache
Member
Posted 6 minutes ago #

I have a listings custom post type. Each listing has a custom field where an email can be entered. This is the owner of the listing and where the form will be sent.

I'm using the wpcf7_mail_components hook to dynamically set the email:

function wpcf7_dynamic_email_field($components) { // Get email from post custom field // $email = '[email protected]'; // $components['recipient'] = $email; retu $components;
}
add_filter('wpcf7_mail_components', 'wpcf7_dynamic_email_field');

... but I'm not sure how to get the ID of the post the form was submitted from. I tried using get_theID() or global $post; $post->ID but that doesn't work.

WordPress ...
ما را در سایت WordPress دنبال می کنید

برچسب : نویسنده : استخدام کار wpss بازدید : 237 تاريخ : پنجشنبه 17 تير 1395 ساعت: 1:47