wc_page_no_robots()
Disable search engines indexing core, dynamic, cart/checkout pages. Uses "wp_robots" filter introduced in WP 5.7.
No Hooks.
Returns
Array. Filtered robots directives.
Usage
wc_page_no_robots( $robots );
- $robots(array) (required)
- Associative array of robots directives.
Changelog
| Since 5.0.0 | Introduced. |
wc_page_no_robots() wc page no robots code WC 10.8.1
function wc_page_no_robots( $robots ) {
if ( is_page( wc_get_page_id( 'cart' ) ) || is_page( wc_get_page_id( 'checkout' ) ) || is_page( wc_get_page_id( 'myaccount' ) ) ) {
return wp_robots_no_robots( $robots );
}
return $robots;
}