Created
April 25, 2018 12:02
-
-
Save robwent/f6d95ddd19d38a936c0d0ad5372081d8 to your computer and use it in GitHub Desktop.
Removes WooCommerce noindex robots tag on public pages
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@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; });