Disable RankMath Content Analysis on Specific Category Posts

#433086
  • Resolved Abdur
    Rank Math free

    Hello, I want to disable content analysis on specific category posts. For example, I have a category called FAQ and I want to disable content analysis on every post which is under FAQ category. How can I do that?

    Thanks.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Prabhat
    Rank Math agency

    Hello,

    Thank you for contacting the support.

    Could you confirm if you’re referring to a specific Content Analysis test or all of them?

    In any case, you can modify and use the filters from this guide to achieve the desired output: https://rankmath.com/kb/disable-seo-content-tests/

    Here’s how you can add the filter: https://rankmath.com/kb/wordpress-hooks-actions-filters/

    Hope this helps and feel free to let us know if you have any questions.

    Thank you.

    Abdur
    Rank Math free

    I want to Disable the Length of the Content Test on only specific category posts.

    This is the code for this

    /**
    * Filter to disable length of the content test
    */
    add_filter(‘rank_math/researches/tests’, function ($tests, $type) {
    unset($tests[‘lengthContent’]);
    return $tests;
    }, 10, 2 );

    But I only want to disable this for a specific category.

    How can I do that?

    Prabhat
    Rank Math agency

    Hello,

    Please modify and add the below filter to the website and see if you get the desired output:

    add_filter('rank_math/researches/tests', function ($tests, $type) {
    	$exclude = [1, 10];    // replace with Category ID
    	$cat = get_the_category()[0]->term_id;
    	if( false !== in_array($cat, $exclude) ){
    		unset($tests['lengthContent']);
    	}
    	return $tests;
    }, 10, 2 );

    In the above filter, you’ll need to replace 1, 10 with the IDs of the categories where the test is to be disabled. Here’s how you can find the ID: https://www.wpbeginner.com/beginners-guide/how-to-find-post-category-tag-comments-or-user-id-in-wordpress/#find-category-tag-id

    Let us know how that goes.

    Thank you.

    Abdur
    Rank Math free

    Thank you so, so much, Prabhat. I really appreciate it.

    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/#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 - 1 through 5 (of 5 total)

You must be logged in to reply to this ticket.