Title: Plugin improvement &amp; patch
Last modified: June 19, 2026

---

# Plugin improvement & patch

 *  [adrienikadia](https://wordpress.org/support/users/adrienikadia/)
 * (@adrienikadia)
 * [4 months ago](https://wordpress.org/support/topic/plugin-improvement-patch/)
 * Hello,
 * I’m reaching out because your plugin was not working properly on one of our client’s
   websites. I have patched the issue.
 * The filter add_filter( ‘wpcf7_form_elements’, [ $this, ‘inject_hidden_fields’],
   20, 2 ) no longer passes the second parameter $form. It therefore needs to be
   retrieved differently. I patched it as follows:
 * if ( ! $form ) {
   $form = WPCF7_ContactForm::get_current();if ( ! $form ) {return
   $content;}}
 * Additionally, would it be possible to add “gclid” to the supported fields? I 
   added it on my end in several places across the arrays and the JS. The main change
   being in inject_hidden_fields:
 * foreach ( [ ‘source’, ‘medium’, ‘campaign’, ‘id’, ‘term’, ‘content’, ‘gclid’ ]
   as $key ) {
   $name = str_starts_with( $key, ‘utm_’ ) || $key === ‘gclid’ ? $key:‘
   utm_’ . $key;$fields .= ‘<input type=”hidden” name=”‘ . esc_attr( $name ) . ‘”
   class=”utm utm_’ . esc_attr( $key ) . ‘” value=”” />’ . “\n”;}
 * For better portability, it would also be worth considering adding custom filters.
 * Thank you in advance.
 * Best regards,

You must be [logged in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fplugin-improvement-patch%2F%3Foutput_format%3Dmd&locale=en_US)
to reply to this topic.

 * ![](https://ps.w.org/utm-tracker-for-contact-form-7/assets/icon-256x256.png?rev
   =3334582)
 * [UTM Tracker for Contact Form 7](https://wordpress.org/plugins/utm-tracker-for-contact-form-7/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/utm-tracker-for-contact-form-7/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/utm-tracker-for-contact-form-7/)
 * [Active Topics](https://wordpress.org/support/plugin/utm-tracker-for-contact-form-7/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/utm-tracker-for-contact-form-7/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/utm-tracker-for-contact-form-7/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [adrienikadia](https://wordpress.org/support/users/adrienikadia/)
 * Last activity: [4 months ago](https://wordpress.org/support/topic/plugin-improvement-patch/)
 * Status: not resolved