How to noindex a custom post type in WordPress
To noindex a whole custom post type with Hydrogen SEO, open Hydrogen SEO → Robots, find the type in the Post Types table and switch on Noindex. Every entry of that type then prints noindex, follow and its sitemap is dropped. Without a plugin, a wp_robots filter does the same.
Themes and plugins register post types for things that are not pages in their own right: testimonials, team members, sliders, FAQ items, portfolio pieces shown in a grid. When the type is public, each entry gets its own URL, often with one sentence on it. Those are the ones worth hiding.
Step by step
1. Check that the type has public URLs at all
Open an entry of the type on the front end. If it loads at an address such as /testimonial/acme-review/, the type is publicly queryable and can be indexed. If you get a 404, the type was registered without public pages and there is nothing to noindex. The developer's alternative, where you control the registration, is to set 'publicly_queryable' => false in register_post_type() so the URLs never exist.
2. Find the post type name
You need the registered name for code, and it helps you recognise the right row in the plugin. Open the type's list in wp-admin and read the address bar: edit.php?post_type=testimonial means the name is testimonial. Posts and Pages are post and page.
3. Switch on Noindex for the type
- Open Hydrogen SEO → Robots.
- In the Post Types table, find the row. Public custom post types are listed in the same table as Posts and Pages.
- Switch on Noindex. Leave Nofollow off, so links on those entries are still followed.
- The change saves automatically.
From then on, each entry of the type carries the directive unless that entry has its own override.
4. Handle the archive page
If the type was registered with has_archive, it also has a listing page such as /testimonial/. The Post Types switch covers the single entries. The archive follows the site default, which is index, follow. To noindex the archive too with Hydrogen SEO active, filter the plugin's directives:
add_filter( 'hydrogen_seo_robots_directives', function ( $directives ) {
if ( is_post_type_archive( 'testimonial' ) ) {
return array( 'noindex', 'follow' );
}
return $directives;
} );
Often the archive is the one page worth keeping, since it gathers every entry in one place. Decide before hiding it.
5. Or do it with code and no plugin
On a site without an SEO plugin, use core's wp_robots filter (WordPress 5.7 and later):
add_filter( 'wp_robots', function ( $robots ) {
if ( is_singular( 'testimonial' ) || is_post_type_archive( 'testimonial' ) ) {
$robots['noindex'] = true;
$robots['follow'] = true;
}
return $robots;
} );
This filter is not the right hook while Hydrogen SEO is active, because the plugin prints its own robots tag and removes core's. Use the hydrogen_seo_robots_directives filter above in that case.
6. Take the type out of the sitemap
With the plugin, a noindexed type gets a NoIndex badge on Hydrogen SEO → Sitemap and its sitemap is left out of the index, so there is nothing more to do. With core sitemaps and the code route, remove it yourself:
add_filter( 'wp_sitemaps_post_types', function ( $post_types ) {
unset( $post_types['testimonial'] );
return $post_types;
} );
A sitemap that lists URLs you have marked noindex sends search engines two opposite signals.
7. Verify one entry and one exception
View the source of an entry and confirm the robots tag reads noindex, follow. If a single entry deserves to rank, such as a detailed case study inside a thin portfolio type, open it, open the SEO Settings sheet, and under Robots Meta set it back to index. In the post list, Quick Edit → Indexing → Index does the same. Per-post settings always win over the post type default.
Noindex, or stop creating the pages
Noindex is the right tool when visitors still use the single pages. If nobody should ever land on them, removing the URLs is cleaner: set publicly_queryable to false where you own the registration, or redirect each entry to the page that displays them. A noindexed page is still crawled from time to time. A page that does not exist costs nothing.
Pitfalls
- Blocking the type's path in robots.txt as well. Crawlers then cannot read the noindex, and linked entries can stay listed.
- Noindexing a WooCommerce or events post type by mistake. Check the row name twice.
productand event types usually carry the pages you most want indexed. - Expecting an instant drop. Entries leave the index as each one is recrawled.
Common questions
Does noindexing a post type remove it from my site?
No. Visitors, menus and internal search still reach the entries. Only search engines are asked to leave them out of results.
Can I noindex a post type but keep one entry indexed?
Yes. Set the type to Noindex on the Robots screen, then set that entry to Index in its SEO Settings sheet or in Quick Edit. The per-post choice overrides the type.
Why is my custom post type missing from the Robots table?
Only public post types are listed. A type registered as non-public has no front-end URLs, so there is nothing for a robots tag to control.