• For example i have a page on my wordpress called anything.php which has “anything.php?id=<?php echo $post->ID; ?>” and need a function that disables a plugin on that page, only in this page, you can create a function like this for that …

    function remove_plugin_name() {
    
    		if (!is_page('anything.php?id=<?php echo $post->ID; ?>')){
    
    	   remove_action('remove_plugin_name';}
        }

    If so, how and where should I apply it …?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi,

    This will depend on which plugin is being used as each plugin will add different ‘actions’ etc. You will need to see what actions your plugin is adding/using and remove them on specific pages as below:

    if ( strstr( $_SERVER['REQUEST_URI'], 'anything.php' ) ){
    
        // Remove Actions
        remove_action( 'wp_action_name', 'your_plugins_function_one' );
        remove_action( 'wp_action_name', 'your_plugins_function_two' );
    
        // Remove Scripts
        wp_dequeue_script( 'script_name_one' );
        wp_dequeue_script( 'script_name_two' );
    
    }

    The above code would need to be placed before any instance of wp_head()

    (should be ok in your functions.php file)

    Thread Starter nrms

    (@nrms)

    First of all, thanks for the reply.

    In this case the plugin is SEO by Yoast and the page / template where i need to disable it is game.php, which gives a url for example:
    …/game.php?id=485.

    If it really is possible with your help, I am immensely grateful.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘function to disable plugin in custom page’ is closed to new replies.