addressalign-toparrow-leftarrow-leftarrow-right-10x10arrow-rightbackbellblockcalendarcameraccwcheckchevron-downchevron-leftchevron-rightchevron-small-downchevron-small-leftchevron-small-rightchevron-small-upchevron-upcircle-with-checkcircle-with-crosscircle-with-pluscontroller-playcredit-cardcrossdots-three-verticaleditemptyheartexporteye-with-lineeyefacebookfolderfullheartglobe--smallglobegmailgooglegroupshelp-with-circleimageimagesinstagramFill 1languagelaunch-new-window--smalllight-bulblightning-boltlinklocation-pinlockm-swarmSearchmailmediummessagesminusmobilemoremuplabelShape 3 + Rectangle 1ShapeoutlookpersonJoin Group on CardStartprice-ribbonprintShapeShapeShapeShapeImported LayersImported LayersImported Layersshieldstar-shapestartickettrashtriangle-downtriangle-uptwitteruserwarningyahooyoutube

Noindexing WooCommerce special pages

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

 

email-signature

 

 

This email message originally included an attachment.

People in this
group are also in: