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

  1. forwardtrends
    Posted 3 years 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?


  2. Zack Katz
    Plugin Author

    Posted 3 years 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
    Posted 3 years 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

  • Contact Form 7 Modules
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic