Ad blocker blocks form ID
-
Hi MC4WP team,
Previously, I had been able to prevent ad-blockers from hiding the MC4WP form by replacing the form class with a more generic name, as follows:
/** * Replace MC4WP default form class to prevent ad-blocker from hiding the subscribe form. * See also https://kb.mc4wp.com/add-css-class-to-form-element/ */ function my_mc4wp_replace_form_class( $classes ) { // Remove MC4WP default class $remove_value = 'mc4wp-form'; if ( ( $key = array_search($remove_value, $classes) ) !== false ) { unset( $classes[$key] ); } // Add generic class name $classes[] = 'form-latestnews'; return $classes; } add_filter( 'mc4wp_form_css_classes', 'my_mc4wp_replace_form_class' );
Unfortunately, ad-blockers have smartened up and are now also recognizing MC4WP by the MC4WP form ID (e.g.
mc4wp_form_widget-2
andmc4wp-form-1
).I have found the ‘mc4wp_form_element_attributes’ filter, but this does not seem to allow changing of the form ID.
How can one replace the MC4WP form ID to make it more generic, and thus prevent ad-blockers from hiding the form?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Ad blocker blocks form ID’ is closed to new replies.