Merge pull request #28949 from woocommerce/fix/28947
Use wp_robots_no_robots() when available
This commit is contained in:
commit
32b502dcd2
|
@ -3568,8 +3568,13 @@ function wc_empty_cart_message() {
|
||||||
*/
|
*/
|
||||||
function wc_page_noindex() {
|
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' ) ) ) {
|
if ( is_page( wc_get_page_id( 'cart' ) ) || is_page( wc_get_page_id( 'checkout' ) ) || is_page( wc_get_page_id( 'myaccount' ) ) ) {
|
||||||
|
// Adds support for WP 5.7.
|
||||||
|
if ( function_exists( 'wp_robots_no_robots' ) ) {
|
||||||
|
wp_robots_no_robots();
|
||||||
|
} else {
|
||||||
wp_no_robots();
|
wp_no_robots();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
add_action( 'wp_head', 'wc_page_noindex' );
|
add_action( 'wp_head', 'wc_page_noindex' );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue