Disable Rank Math All Meta Data & OG Tags

#50910
  • Resolved Satinder Singh
    Rank Math free

    Can I disable Rank Math all meta data, title, description, canonical, json and all social og: tags on a particular page with one filter hook?

    Means i just want to disable Rank Math completely on a particular page.

    or can we disable Rank Math completely inside a custom post-type for which I have added dynamic/automatic SEO tags via code?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Alberto
    Rank Math business

    Hello,

    Thank you for contacting Rank Math and sorry for any inconvenience that might have been caused due to that.

    You can use the hooks you can find here: https://rankmath.com/kb/filters-hooks-api-developer/#breadcrumbs to remove every meta data and OG tag Rank Math adds in a custom post type.

    For example, let’s say you have a custom post type called “MyCustomPostType”. To remove all the OG tags on posts of that type, you can use this filter:

    /**
     * Hook to remove og:tags
     */
    add_action( 'rank_math/head', function() {
            if(is_singular('MyCustomPostType'){
    	    remove_all_actions( 'rank_math/opengraph/facebook' );
    	    remove_all_actions( 'rank_math/opengraph/twitter' );
            }
    });

    This one would be to remove the Rank Math Json+Ld Data:

    /**
     * Code to remove json+ld data
     * 
     */
    add_action( 'rank_math/head', function() {
           if(is_singular('MyCustomPostType'){
    	    global $wp_filter;
    	    if ( isset( $wp_filter["rank_math/json_ld"] ) ) {
    	        unset( $wp_filter["rank_math/json_ld"] );
    	    }
            }
    });

    `
    Looking forward to helping you. Thank you.

    ​​​​​​​

    I know about these filters but i just want to completely disable title / meta descriptions – everything from rank math on my custom post type front-end page.

    Also you mentioned a filter to change any social og tag but below not working.

    add_filter( "rank_math/opengraph/facebook/image:width", function( $content ) {
    $content = '600';
    return $content;
    });
    Todd
    Rank Math free

    Hi Satinder,

    I am afraid we do not have a custom filter for doing that.

    Sorry.

    I managed to do this, you already have a filter to change custom og:width 🙂

    here is correct one:-

    add_filter( "rank_math/opengraph/facebook/og_image_width", function( $content ) {
    $content = '600';
    return $content;
    });
    Todd
    Rank Math free

    Hi,

    You had mentioned you wanted the title/description removed on a particular post.

    I am glad it is working fine for you.

    Please do not hesitate to let us know if you need our assistance with anything else.

Viewing 6 replies - 1 through 6 (of 6 total)

The ticket ‘Disable Rank Math All Meta Data & OG Tags’ is closed to new replies.