plugins – How To Noindex Specific Urls On WooCommerce

Question

I am trying to set noindex meta tag when some specific url is selected.

example url:

domain.com/dress/?f=_sale%5Bsale%5D

domain.com/dress/?f=colour%5Baquamarine%5D%7C_sale%5Bsale%5D

I am trying the bellow code but not working

    function cp_prevent_indexing_ajax () {
        if (isset($_GET['?f=colour'])){
            echo '<meta name="robots" content="noindex, nofollow">';
        }
    }
}

in progress 0
sot 2 months 2021-07-29T08:29:30-05:00 0 Answer 0 views 0

Answer ( 1 )

    0
    2021-08-01T07:50:56-05:00

    That’s not how you use GET vars: php.net/manual/en/reserved.variables.get.php

Leave an answer

Browse
Browse