WordPress.org

Ready to get started?Download WordPress

Forums

Contact Form 7 Dynamic Text Extension
[resolved] get custom_field based on post id and key (2 posts)

  1. Popescu M
    Member
    Posted 3 months ago #

    Hi, I have a small directory website where visitors can click on a send email button that opens a page like site.com/send-email/id where id is the post_id and then send an email to the company which has that id.

    How can I populate the contact form email address based on the custom field key and that id? I saw [dynamictext recipient-email uneditable "CF7_get_custom_field key='user_email'"] but is there a way to get the variable from the url and use it?

    Thank you!

    https://wordpress.org/plugins/contact-form-7-dynamic-text-extension/

  2. sevenspark
    Member
    Plugin Author

    Posted 3 months ago #

    Hi Popescu,

    That ID is likely stored in a $_GET variable, so you may be able to retrieve it that way. Alternatively, you could parse the URL, but the value is almost certainly present in either the $_GET array or Query Vars.

    If you need to determine a value based on both a custom field and the post ID, you'd probably need to write a custom shortcode to do that.

    Hope that helps,

    Chris

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.