From: | Gal B. |
Sent on: | Wednesday, June 25, 2014, 11:18 AM |
Hi guys,
It occurred to me that special shopping cart pages should not be indexed, because they required login and/or they are rather blank, so I've written some code for Yoast SEO and WooCommerce, which you may find useful.
function woo_seo_noindex_special_pages () {
global $post;
$woocommerce_pages = array('cart', 'checkout', 'order-received', 'my-account', 'logout', 'mijireh-secure-checkout');
$slug = get_post($post)->post_name;
if (in_array($slug, $woocommerce_pages)) {
echo '<meta name="robots" content="noindex,follow"/>' . "\n";
}
}
add_action('wpseo_head', 'woo_seo_noindex_special_pages');
If you don't know what to do with this, give it to your developer. If you know what to do with it and have something to add/change, please let me know.
Enjoy,
Gal
This email message originally included an attachment.