How to disable plugin on a single page

#8898
  • Resolved Jason Saunders
    Rank Math free

    Hi there,

    Just wondering if it’s at all possible to disable this plugin on a specific page?

    My developer has written a bit of code to create dynamic page titles for a specific page based on different on page filters.

    Installation of your plugin seems to override this 🙂

    Best
    Jason

    • This topic was modified 4 years, 10 months ago by Jason Saunders. Reason: Support requested admin access to site to test
Viewing 5 replies - 16 through 20 (of 20 total)
  • Hi Jason,

    Apologies for the delay.

    Here is a new pastebin that includes the RankMath code: https://pastebin.com/38jYibS7

    Let us know how this works for you. Thank you.

    Haha, getting somewhere – the plugin is definitely disabled now but it has stripped out the title and meta tags completely.

    Here’s the code I’m using for dynamic titles:

    // DYNAMIC PAGE TITLE FOR COUNTRY FILTERING
    function dynamic_directory_title() {
    	if(!empty($_GET['country'])){
    		$cc = $_GET['country'];
    		$countries = New WC_Countries();
    		$all_countries = $countries->get_countries();
    		
    		return 'Emerging fashion designers in ' . $all_countries[$cc] . ' - Rize';
    	}
    	return;
    }
    add_action( 'pre_get_document_title', 'dynamic_directory_title' );
    

    If I deactivate the Rank Math plugin via the admin UI this works fine.

    Any thoughts?

    Hi Jason,

    Thanks for the follow up.

    Please note that you can also dynamically change the RankMath page titles using the same logic by making use of the following code:

    /**
     * Filter to change the page title.
     * 
     * @param string $title
     */
    add_filter( 'rank_math/frontend/title', function( $title ) {
    if( is_page( '1161' ) && !empty($_GET['country'])) {
        $cc = $_GET['country'];
        $countries = New WC_Countries();
        $all_countries = $countries->get_countries();
    		
        return 'Emerging fashion designers in ' . $all_countries[$cc] . ' - Rize';
    }
    return $title;
    });

    I hope this info helps. Thank you

    That’s perfect Michael – thanks so much for all of your help 🙂

    Hello,

    We are super happy that this resolved your issue. If you have any other questions in the future, know that we are here to help you.

    If you don’t mind me asking, could you please leave us a review (if you haven’t already) on https://wordpress.org/support/plugin/seo-by-rank-math/reviews/?rate=5#new-post about your overall experience with Rank Math? We appreciate your time and patience.

    If you do have another question in the future, please feel free to create a new forum topic, and it will be our pleasure to assist you again.

    Thank you.

Viewing 5 replies - 16 through 20 (of 20 total)

The ticket ‘How to disable plugin on a single page’ is closed to new replies.