Advertisement
jaideep06

Noindex canonical

Oct 28th, 2024
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.36 KB | None | 0 0
  1. add_action( 'rank_math/head', function() {
  2.     if (is_product_category()){
  3.         $canonical =  RankMath\Paper\Paper::get()->get_canonical();
  4.         $can =  substr($canonical, 0, strpos($canonical, "page"));
  5.         if ( MyThemeShop\Helpers\Str::is_non_empty( $can ) ) {
  6.             echo '<link rel="canonical" href="'. esc_url( $can, null, 'other' ) . '" />' . "\n";
  7.         }
  8.     }
  9. } );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement