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.
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?
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.
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.