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

This commit is contained in:
Mike Jolley 2017-06-21 12:52:52 +01:00
parent e3a9cc9a3d
commit dbe9705e4b
1 changed files with 12 additions and 0 deletions

View File

@ -2658,3 +2658,15 @@ function wc_logout_url( $redirect = '' ) {
function wc_empty_cart_message() {
echo '<p class="cart-empty">' . apply_filters( 'wc_empty_cart_message', __( 'Your cart is currently empty.', 'woocommerce' ) ) . '</p>';
}
/**
* Disable search engines indexing core, dynamic, cart/checkout pages.
*
* @since 3.2.0
*/
function wc_page_noindex() {
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();
}
}
add_action( 'wp_head', 'wc_page_noindex' );