Skip to content

Instantly share code, notes, and snippets.

@deeman
Created December 5, 2019 12:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deeman/cbae244e1ee27ce702b83a0adce055b9 to your computer and use it in GitHub Desktop.
Save deeman/cbae244e1ee27ce702b83a0adce055b9 to your computer and use it in GitHub Desktop.
NoIndex WooCommerce 'Order by' archives - via PHP
// Woocommerce SEO — Noindex 'Order by' archives
// Prevent indexing "Order by"
add_action( 'wp_head', 'woo_prevent_indexing_orderby' );
if(!function_exists('woo_prevent_indexing_orderby')){
function woo_prevent_indexing_orderby () {
if (isset($_GET['orderby'])){
echo '<meta name="robots" content="noindex, nofollow">';
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment