Skip to content

Instantly share code, notes, and snippets.

@guydumais
Created July 3, 2017 07:55
Show Gist options
  • Save guydumais/fbd6b4410f8902197d6f780d05c6a4cc to your computer and use it in GitHub Desktop.
Save guydumais/fbd6b4410f8902197d6f780d05c6a4cc to your computer and use it in GitHub Desktop.
WordPress / Disable duplicate content for categories
<?php
/**
* Disable duplicate content for categories.
*
* @author Guy Dumais.
* @link https://en.guydumais.digital/how-to-avoid-duplicate-content-in-wordpress/
*/
add_action( 'wp_head', $af = function() {
// Add noindex, follow robot meta tag for categories.
if ( is_category() ) {
wp_no_robots();
}
} );
unset( $af );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment