wc_page_noindex()
Disable search engines indexing core, dynamic, cart/checkout pages.
No Hooks.
Returns
null. Nothing (null).
Usage
wc_page_noindex();
Changelog
| Since 3.2.0 | Introduced. |
wc_page_noindex() wc page noindex code WC 10.6.2
function wc_page_noindex() {
// wp_no_robots is deprecated since WP 5.7.
if ( function_exists( 'wp_robots_no_robots' ) ) {
return;
}
if ( is_page( wc_get_page_id( 'cart' ) ) || is_page( wc_get_page_id( 'checkout' ) ) || is_page( wc_get_page_id( 'myaccount' ) ) ) {
wp_no_robots();
}
}