wc_page_no_robots()WC 5.0.0

Disable search engines indexing core, dynamic, cart/checkout pages. Uses "wp_robots" filter introduced in WP 5.7.

No Hooks.

Return

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() code WC 8.7.0

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;
}