-
-
Save robwent/f6d95ddd19d38a936c0d0ad5372081d8 to your computer and use it in GitHub Desktop.
function YOURPREFIX_remove_wc_account_page_noindex(){ | |
if (!is_user_logged_in()) { | |
remove_action( 'wp_head', 'wc_page_noindex' ); | |
} | |
} | |
add_action( 'init', 'YOURPREFIX_remove_wc_account_page_noindex' ); |
@iamalexm are you sure any other code/function/plugin isn't overriding it?
@srjlulla yes pretty sure. I used a troobleshooting plugin, all other plugins are deactivated exept rank math, rank math pro and woocommerce.
With woocommerce deactivated my meta looks like this:
<meta name="robots" content="follow, index, max-snippet:-1, max-video-preview:-1, max-image-preview:large">
With woocommerce activated :
<meta name="robots" content="follow, noindex">
I tried both snippet above but none are working.
@srjlulla after further research it was the rank math plugin who was considering my pages as checkout because of some code. So if you're using rank math and have this noindex issue you can use the next snippet :
add_filter( 'rank_math/frontend/robots', function( $robots ) { if( is_checkout() ) { $robots['index'] = 'index'; $robots['follow'] = 'follow'; } return $robots; });
@srjlulla thanks for the snippet but it doesn't work for me. Do you know if there's another way to remove the noindex meta?