子テーマのfunctions.phpに以下のコードを追加することで変更が可能です。
必要に応じて書き換えて頂ければと思います。
//noindex、nofollowの調整
remove_action( 'wp_head', 'sng_meta_robots' ,999);
add_action( 'wp_head', 'my_meta_robots' ,100);
function my_meta_robots() { global $post; $rogots_tags = ''; if ( is_attachment() ) {//メディアページの場合 $rogots_tags = 'noindex,nofollow'; } elseif ( is_page() || is_single() ) { //記事・固定ページの場合 $robots_r = get_post_meta( $post->ID, "noindex_options", true ); if( is_array($robots_r) ) { $rogots_tags = ( in_array('noindex', $robots_r) && !in_array('nofollow', $robots_r)) ? 'noindex,follow' : implode( ",", $robots_r ); } } elseif( is_paged() || is_tag() || is_date() ){ //2ページ目以降、アーカイブ、タグ //コメントアウトで非表示に //$rogots_tags = 'noindex,follow'; } elseif( is_search() ){ //検索結果はインデックスしない $rogots_tags = 'noindex,nofollow'; } elseif( is_category() ){ //カテゴリーページ //初期設定ではインデックス。下記のコメントアウトを外すとnoindexに //$rogots_tags = 'noindex,follow'; } if($rogots_tags) echo '';//出力
} //END noindex、nofollowの調整
WordPressテーマSANGOの質問
タグページにnoindexがつかないようにしたい
タグの記事一覧ページのヘッダー内に「noindex,follow」のメタタグが付く状態になっておりますが、小テーマ内での編集で「noindex,follow」のメタタグを付けないようにすることはできますか?