Request for new filters
-
Hi,
I stumbled upon an interesting limitation in some scenarios with cf7 and the Beaver Builder plugin, which I would like to solve in a more elegant way than I currently am (I’m right now using MU plugins, without any real filters).
The scenario:
When using the Beaver Themer, a tool for creating page templates for various posts or pages that match given criterias, thein_the_loop()returnsfalse, because the post content is fetched using a secondaryWP_Query(). This makes cf7 not populate the_wpcf7_container_postfield.My current “solution”:
A mu-plugin has been created, which uses the existingwpcf7_form_hidden_fieldsfilter to add my own field which usesget_the_ID(), and then I look for$_POST['_wpcf7_container_post']entries that have the value0, and override it with my own form field from the filter.Proposed solution:
includes/contact-form.php:466already has thewpcf7_form_hidden_fieldsfilter, but this just appends new entries to the fixed set of fields cf7 provides.It would be great if a filter was implemented that allowed overriding the built in ones in some scenarios. I see no immediate drawback by passing
$hidden_fields, instead of an empty array, to thewpcf7_form_hidden_fieldsfilter, since this already expects an array, and those extending it have not been able to touch the array keys that were pre-defined by cf7 until now either.$hidden_fields += (array) apply_filters( 'wpcf7_form_hidden_fields', $hidden_fields );Alternatively, implementing a new filter following this, if there are backwards compatibility concerns
$hidden_fields += (array) apply_filters( 'wpcf7_form_hidden_fields', array() ); $hidden_fields = (array) apply_filters( 'wpcf7_form_all_hidden_fields', $hidden_fields );
The topic ‘Request for new filters’ is closed to new replies.