wc_page_noindex()WC 3.2.0

Disable search engines indexing core, dynamic, cart/checkout pages.

No Hooks.

Return

null. Nothing (null).

Usage

wc_page_noindex();

Changelog

Since 3.2.0 Introduced.

wc_page_noindex() code WC 8.7.0

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