Created
July 3, 2017 07:55
-
-
Save guydumais/fbd6b4410f8902197d6f780d05c6a4cc to your computer and use it in GitHub Desktop.
WordPress / Disable duplicate content for categories
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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