How to configure Rank Math SEO plugin with Ajax product Filter
Some user are experiencing an issue with Rank Math SEO plugin and our YITH WooCommerce Ajax Product filter plugin.
The issue is that you found two different meta robots in your filtered page:
One is added by us and the other one is added by Rank Math SEO plugin.
When you use a SEO plugin lyou don't need to use the SEO options of our plugin.
The Rank Math plugin allow us to add the noindex, nofollow with a php script. Please, copy and past this code at the end of functions.php file:
if( ! function_exists( 'yith_wcan_robots' ) ){
function yith_wcan_robots( $robots ){
if( ! empty( $_GET['yith_wcan'] ) ){
$robots['index'] = 'noindex';
$robots['follow'] = 'nofollow';
}
return $robots;
}
add_filter( 'rank_math/frontend/robots', 'yith_wcan_robots' );
}
After that go in YITH > ajax Product Filter > SEO and change the settings in this way:
You simply need to disable the Meta Tag because we use the Rank Mat feature for this. Optionally, you should enable the option to enable the nofollow to filter anchors.