Hi Dave,
Thanks for using the plugin. Does the form in question appear only on a single page? Is it a comment form or a contact/registration form?
Hi Jesin, It is a couple forms on a bunch of pages and they all do contact info, name, email, etc.
I was just wondering if the validate call can be made to be conditional like if class=’classname’ or if $Input=’#input_id’ then validate function.
thanks!
– Dave
Sorry for the delayed response. You can use the following code to exclude this plugin from pages that don’t have a contact form.
if ( ! is_admin() ) {
add_filter( 'option_active_plugins', function( $plugins ) {
if ( ! isset( $_SERVER['HTTP_REFERER'] ) ) { $_SERVER['HTTP_REFERER'] = null; }
$request_uri = parse_url( $_SERVER['REQUEST_URI'], PHP_URL_PATH );
$referer_uri = parse_url( $_SERVER['HTTP_REFERER'], PHP_URL_PATH );
if ( ! strpos( $request_uri, '/contact-us/' ) && ! strpos( $referer_uri, '/contact-us/' ) ) {
$key = array_search( 'mailgun-email-validator/plugin.php', $plugins );
if ( false !== $key ) {
unset( $plugins[ $key ] );
}
}
return $plugins;
});
}
If you have multiple pages add them all to the if condition:
if ( ! strpos( $request_uri, '/contact-us/' ) && ! strpos( $referer_uri, '/contact-us/' ) && ! strpos( $request_uri, '/page-2/' ) && ! strpos( $referer_uri, '/page-2/' ) ) {
Create a directory named mu-plugins inside wp-content and paste the code in a new file e.g. mailgun-exclude.php