Advertisement
palsushobhan

remove-store-pages-from-sitemap-and-add-noindex-meta

Sep 19th, 2023 (edited)
687
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.68 KB | None | 0 0
  1. add_action( 'init', function() {
  2.     global $WCFMmp;
  3.     remove_action( 'init', array( $WCFMmp->wcfmmp_store_seo, 'register_sitemap' ) );
  4. }, 9 );
  5.  
  6. add_filter( 'wpseo_sitemap_index', function($i) {
  7.     global $WCFMmp;
  8.     remove_filter( 'wpseo_sitemap_index', array( $WCFMmp->wcfmmp_store_seo, 'wcfmmp_add_sellers_sitemap' ), 100 );
  9.     return $i;
  10. }, 99);
  11.  
  12. add_filter( 'wpseo_robots', 'yoast_seo_robots_for_venders' );
  13. add_filter( 'wpseo_googlebot', 'yoast_seo_robots_for_venders' );
  14. add_filter( 'wpseo_bingbot', 'yoast_seo_robots_for_venders' );
  15.  
  16. function yoast_seo_robots_for_venders($robots) {
  17.     if (wcfm_is_store_page()) {
  18.         return 'noindex, follow';
  19.     }
  20.     return $robots;
  21. }
  22.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement