Created
June 1, 2022 03:07
-
-
Save mono96/d76f3497e82918205550e3f03b094c9d to your computer and use it in GitHub Desktop.
WordPressのアーカイブ2ページ目以降にnoindexを付与。要件:WordPress 5.7以降
This file contains 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
//2ページ目以降にnoindex付与 | |
add_filter( 'wp_robots', function( $robots ) { | |
if ( is_paged() ) { | |
$robots['noindex'] = true; | |
} | |
return $robots; | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment