WordPress.org

Ready to get started?Download WordPress

Forums

Contact Form 7 Modules
[resolved] How to apply filter (3 posts)

  1. forwardtrends
    Member
    Posted 1 year ago #

    I'm trying to apply a few dynamic fields (for an event location, name, address, etc.) to one hidden field. I can pull these values out in my template, but how do I apply them to a hidden field using a filter?

    http://wordpress.org/extend/plugins/contact-form-7-modules/

  2. Zack Katz
    Member
    Plugin Author

    Posted 1 year ago #

    // Like this:
    add_filter('wpcf7_hidden_field_value', 'my_function_to_change_hidden_field_value');
    
    // or like this, if your field has an ID of "example_id"
    add_filter('wpcf7_hidden_field_value_example_id', 'my_function_to_change_hidden_field_value');
    
    function my_function_to_change_hidden_field_value($value) {
    	return 'a different value';
    }
  3. SternsbergerM
    Member
    Posted 1 year ago #

    After half an hour of searching the problem because it did not work:
    ID means literally the ID and not the name of the field

    [hidden Fieldname id:FieldID "---"]
    add_filter('wpcf7_hidden_field_value_FieldID', ...)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags