{"id":1599,"date":"2019-12-08T13:06:24","date_gmt":"2019-12-08T05:06:24","guid":{"rendered":"https:\/\/www.intelliwolf.com\/?p=1599"},"modified":"2019-12-08T13:07:55","modified_gmt":"2019-12-08T05:07:55","slug":"noindex-wordpress-subpages","status":"publish","type":"post","link":"https:\/\/www.intelliwolf.com\/noindex-wordpress-subpages\/","title":{"rendered":"How To Noindex WordPress Subpages"},"content":{"rendered":"\n

A technique commonly used in Search Engine Optimization (SEO) is to tell the search engines that you don't want particular pages to show up in the search results.<\/p>\n\n\n\n

The code you need in the HTML of the page is:<\/p>\n\n\n\n

<meta name='robots' content='noindex, follow'\/><\/code><\/pre>\n\n\n\n

Because the directive is to \"noindex, follow\", most people colloquially refer to that as \"noindexing\" the page.<\/p>\n\n\n\n

The easiest way to noindex particular pages is to use a plugin like Yoast SEO.<\/p>\n\n\n\n

Yoast SEO used to give you an option to noindex subpages, but they removed it in February 2018.<\/p>\n\n\n\n

The team at Yoast have their reasons for removing this option, but I want it, so this is how I coded it.<\/p>\n\n\n\n

How to set WordPress subpages to noindex<\/strong><\/h2>\n\n\n\n

Add this code to the functions.php<\/em> file of your child theme:<\/p>\n\n\n\n

add_action('wp_head', 'robot_meta_subpage_fix', 1);\nfunction robot_meta_subpage_fix() {\n  if(is_paged()) {\n    echo \"<meta name='robots' content='noindex, follow'\/>\", \"\\n\";\n  }\n}<\/code><\/pre>\n\n\n\n

That will add a noindex tag just to subpages, like this:<\/p>\n\n\n\n

\"\"<\/figure><\/div>\n\n\n\n

It won't add the noindex to any other pages on your website. Just the subpages.<\/p>\n\n\n\n

How to replace Yoast SEO's robots tag on subpages<\/h2>\n\n\n\n

The problem with Yoast's implementation is that the default subpage has this robots directive:<\/p>\n\n\n\n

\"\"<\/figure><\/div>\n\n\n\n

In case that's too small, it says:<\/p>\n\n\n\n

<meta name=\"robots\" content=\"max-snippet:-1, max-image-preview:large, max-video-preview:-1\"\/><\/code><\/pre>\n\n\n\n

That robot directive isn't removed when you add your own.<\/p>\n\n\n\n

We want to remove the default Yoast robots meta code for subpages.<\/p>\n\n\n\n

Otherwise we end up with something that looks like this:<\/p>\n\n\n\n

\"\"<\/figure><\/div>\n\n\n\n

If you want to remove the Yoast SEO robots tag for subpages and add your own, paste this code into the functions.php<\/em> file of your Child Theme<\/a>:<\/p>\n\n\n\n

add_action('wp_head', 'robot_meta_subpage_fix', 1);\nfunction robot_meta_subpage_fix() {\n  if(is_paged()) {\n    $wpseo = WPSEO_Frontend::get_instance();\n    remove_action( 'wpseo_head', array( $wpseo, 'robots' ), 10 );\n    echo \"<meta name='robots' content='noindex, follow'\/>\", \"\\n\";\n  }\n}<\/code><\/pre>\n\n\n\n

You'll end up with a header that looks somewhat like this:<\/p>\n\n\n\n

\"\"<\/figure><\/div>\n\n\n\n

<\/p>\n","protected":false},"excerpt":{"rendered":"

A technique commonly used in Search Engine Optimization (SEO) is to tell the search engines that you don’t want particular pages to show up in the search results. The code you need in the HTML of the page is: Because the directive is to “noindex, follow”, most people colloquially refer to that as “noindexing” the<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14],"tags":[],"yoast_head":"\nHow To Noindex WordPress Subpages<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.intelliwolf.com\/noindex-wordpress-subpages\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How To Noindex WordPress Subpages\" \/>\n<meta property=\"og:description\" content=\"A technique commonly used in Search Engine Optimization (SEO) is to tell the search engines that you don't want particular pages to show up in the search results. The code you need in the HTML of the page is: Because the directive is to "noindex, follow", most people colloquially refer to that as "noindexing" the\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.intelliwolf.com\/noindex-wordpress-subpages\/\" \/>\n<meta property=\"og:site_name\" content=\"Intelliwolf\" \/>\n<meta property=\"article:published_time\" content=\"2019-12-08T05:06:24+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-12-08T05:07:55+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/intelliwolf.com\/wp-content\/uploads\/2019\/12\/2019-12-08-noindex-wordpress-subpages-04-600x228.png\" \/>\n<meta name=\"author\" content=\"Mike Haydon\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Mike Haydon\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.intelliwolf.com\/noindex-wordpress-subpages\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.intelliwolf.com\/noindex-wordpress-subpages\/\"},\"author\":{\"name\":\"Mike Haydon\",\"@id\":\"https:\/\/www.intelliwolf.com\/#\/schema\/person\/7209e3ff14822e4d70d5f194a310f343\"},\"headline\":\"How To Noindex WordPress Subpages\",\"datePublished\":\"2019-12-08T05:06:24+00:00\",\"dateModified\":\"2019-12-08T05:07:55+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.intelliwolf.com\/noindex-wordpress-subpages\/\"},\"wordCount\":261,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\/\/www.intelliwolf.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.intelliwolf.com\/noindex-wordpress-subpages\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/intelliwolf.com\/wp-content\/uploads\/2019\/12\/2019-12-08-noindex-wordpress-subpages-04-600x228.png\",\"articleSection\":[\"Plugin Customization\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.intelliwolf.com\/noindex-wordpress-subpages\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.intelliwolf.com\/noindex-wordpress-subpages\/\",\"url\":\"https:\/\/www.intelliwolf.com\/noindex-wordpress-subpages\/\",\"name\":\"How To Noindex WordPress Subpages\",\"isPartOf\":{\"@id\":\"https:\/\/www.intelliwolf.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.intelliwolf.com\/noindex-wordpress-subpages\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.intelliwolf.com\/noindex-wordpress-subpages\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/intelliwolf.com\/wp-content\/uploads\/2019\/12\/2019-12-08-noindex-wordpress-subpages-04-600x228.png\",\"datePublished\":\"2019-12-08T05:06:24+00:00\",\"dateModified\":\"2019-12-08T05:07:55+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.intelliwolf.com\/noindex-wordpress-subpages\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.intelliwolf.com\/noindex-wordpress-subpages\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.intelliwolf.com\/noindex-wordpress-subpages\/#primaryimage\",\"url\":\"https:\/\/intelliwolf.com\/wp-content\/uploads\/2019\/12\/2019-12-08-noindex-wordpress-subpages-04-600x228.png\",\"contentUrl\":\"https:\/\/intelliwolf.com\/wp-content\/uploads\/2019\/12\/2019-12-08-noindex-wordpress-subpages-04-600x228.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.intelliwolf.com\/noindex-wordpress-subpages\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.intelliwolf.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Plugin Customization\",\"item\":\"https:\/\/www.intelliwolf.com\/category\/plugin-customization\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"How To Noindex WordPress Subpages\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.intelliwolf.com\/#website\",\"url\":\"https:\/\/www.intelliwolf.com\/\",\"name\":\"Intelliwolf\",\"description\":\"WordPress, Web Design & Coding Tutorials\",\"publisher\":{\"@id\":\"https:\/\/www.intelliwolf.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.intelliwolf.com\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.intelliwolf.com\/#organization\",\"name\":\"Intelliwolf\",\"url\":\"https:\/\/www.intelliwolf.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.intelliwolf.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.intelliwolf.com\/wp-content\/uploads\/intelliwolf-logo-300t.png\",\"contentUrl\":\"https:\/\/www.intelliwolf.com\/wp-content\/uploads\/intelliwolf-logo-300t.png\",\"width\":300,\"height\":100,\"caption\":\"Intelliwolf\"},\"image\":{\"@id\":\"https:\/\/www.intelliwolf.com\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.intelliwolf.com\/#\/schema\/person\/7209e3ff14822e4d70d5f194a310f343\",\"name\":\"Mike Haydon\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.intelliwolf.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/d5f4754fae310a04dede91d15e57c8a0?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/d5f4754fae310a04dede91d15e57c8a0?s=96&d=mm&r=g\",\"caption\":\"Mike Haydon\"},\"sameAs\":[\"https:\/\/intelliwolf.com\/about-mike-haydon\/\"]}]}<\/script>\n","yoast_head_json":{"title":"How To Noindex WordPress Subpages","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.intelliwolf.com\/noindex-wordpress-subpages\/","og_locale":"en_US","og_type":"article","og_title":"How To Noindex WordPress Subpages","og_description":"A technique commonly used in Search Engine Optimization (SEO) is to tell the search engines that you don't want particular pages to show up in the search results. The code you need in the HTML of the page is: Because the directive is to \"noindex, follow\", most people colloquially refer to that as \"noindexing\" the","og_url":"https:\/\/www.intelliwolf.com\/noindex-wordpress-subpages\/","og_site_name":"Intelliwolf","article_published_time":"2019-12-08T05:06:24+00:00","article_modified_time":"2019-12-08T05:07:55+00:00","og_image":[{"url":"https:\/\/intelliwolf.com\/wp-content\/uploads\/2019\/12\/2019-12-08-noindex-wordpress-subpages-04-600x228.png"}],"author":"Mike Haydon","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Mike Haydon","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.intelliwolf.com\/noindex-wordpress-subpages\/#article","isPartOf":{"@id":"https:\/\/www.intelliwolf.com\/noindex-wordpress-subpages\/"},"author":{"name":"Mike Haydon","@id":"https:\/\/www.intelliwolf.com\/#\/schema\/person\/7209e3ff14822e4d70d5f194a310f343"},"headline":"How To Noindex WordPress Subpages","datePublished":"2019-12-08T05:06:24+00:00","dateModified":"2019-12-08T05:07:55+00:00","mainEntityOfPage":{"@id":"https:\/\/www.intelliwolf.com\/noindex-wordpress-subpages\/"},"wordCount":261,"commentCount":2,"publisher":{"@id":"https:\/\/www.intelliwolf.com\/#organization"},"image":{"@id":"https:\/\/www.intelliwolf.com\/noindex-wordpress-subpages\/#primaryimage"},"thumbnailUrl":"https:\/\/intelliwolf.com\/wp-content\/uploads\/2019\/12\/2019-12-08-noindex-wordpress-subpages-04-600x228.png","articleSection":["Plugin Customization"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.intelliwolf.com\/noindex-wordpress-subpages\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.intelliwolf.com\/noindex-wordpress-subpages\/","url":"https:\/\/www.intelliwolf.com\/noindex-wordpress-subpages\/","name":"How To Noindex WordPress Subpages","isPartOf":{"@id":"https:\/\/www.intelliwolf.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.intelliwolf.com\/noindex-wordpress-subpages\/#primaryimage"},"image":{"@id":"https:\/\/www.intelliwolf.com\/noindex-wordpress-subpages\/#primaryimage"},"thumbnailUrl":"https:\/\/intelliwolf.com\/wp-content\/uploads\/2019\/12\/2019-12-08-noindex-wordpress-subpages-04-600x228.png","datePublished":"2019-12-08T05:06:24+00:00","dateModified":"2019-12-08T05:07:55+00:00","breadcrumb":{"@id":"https:\/\/www.intelliwolf.com\/noindex-wordpress-subpages\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.intelliwolf.com\/noindex-wordpress-subpages\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.intelliwolf.com\/noindex-wordpress-subpages\/#primaryimage","url":"https:\/\/intelliwolf.com\/wp-content\/uploads\/2019\/12\/2019-12-08-noindex-wordpress-subpages-04-600x228.png","contentUrl":"https:\/\/intelliwolf.com\/wp-content\/uploads\/2019\/12\/2019-12-08-noindex-wordpress-subpages-04-600x228.png"},{"@type":"BreadcrumbList","@id":"https:\/\/www.intelliwolf.com\/noindex-wordpress-subpages\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.intelliwolf.com\/"},{"@type":"ListItem","position":2,"name":"Plugin Customization","item":"https:\/\/www.intelliwolf.com\/category\/plugin-customization\/"},{"@type":"ListItem","position":3,"name":"How To Noindex WordPress Subpages"}]},{"@type":"WebSite","@id":"https:\/\/www.intelliwolf.com\/#website","url":"https:\/\/www.intelliwolf.com\/","name":"Intelliwolf","description":"WordPress, Web Design & Coding Tutorials","publisher":{"@id":"https:\/\/www.intelliwolf.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.intelliwolf.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.intelliwolf.com\/#organization","name":"Intelliwolf","url":"https:\/\/www.intelliwolf.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.intelliwolf.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.intelliwolf.com\/wp-content\/uploads\/intelliwolf-logo-300t.png","contentUrl":"https:\/\/www.intelliwolf.com\/wp-content\/uploads\/intelliwolf-logo-300t.png","width":300,"height":100,"caption":"Intelliwolf"},"image":{"@id":"https:\/\/www.intelliwolf.com\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.intelliwolf.com\/#\/schema\/person\/7209e3ff14822e4d70d5f194a310f343","name":"Mike Haydon","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.intelliwolf.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/d5f4754fae310a04dede91d15e57c8a0?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d5f4754fae310a04dede91d15e57c8a0?s=96&d=mm&r=g","caption":"Mike Haydon"},"sameAs":["https:\/\/intelliwolf.com\/about-mike-haydon\/"]}]}},"_links":{"self":[{"href":"https:\/\/www.intelliwolf.com\/wp-json\/wp\/v2\/posts\/1599"}],"collection":[{"href":"https:\/\/www.intelliwolf.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.intelliwolf.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.intelliwolf.com\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.intelliwolf.com\/wp-json\/wp\/v2\/comments?post=1599"}],"version-history":[{"count":0,"href":"https:\/\/www.intelliwolf.com\/wp-json\/wp\/v2\/posts\/1599\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.intelliwolf.com\/wp-json\/wp\/v2\/media?parent=1599"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.intelliwolf.com\/wp-json\/wp\/v2\/categories?post=1599"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.intelliwolf.com\/wp-json\/wp\/v2\/tags?post=1599"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}