By the deindexpages.com editorial teamPublished Updated
WordPress gives you several routes to the same result: a noindex tag from an SEO plugin, a snippet of code, a server header, or simply deleting the page. Which one fits depends on whether the page must stay online.
Choose the method
Goal
WordPress route
Hide one page or post from search, keep it live
SEO plugin per-page setting (noindex)
Hide a type of page (tags, authors, search)
SEO plugin global settings
Hide many specific pages without a plugin
Code using the core wp_robots filter
Hide a PDF or uploaded file
Server or CDN X-Robots-Tag header
Remove the page entirely
Trash and delete it; a 404 is returned (or a redirect, if you add one)
Keep a whole site out during development
Reading setting, plus authentication
Method 1: SEO plugin
Popular SEO plugins such as Yoast SEO, Rank Math and All in One SEO include a per-page setting that controls whether search engines may show the page. Labels and locations change between versions, so look in the plugin's advanced or robots settings in the page editor, and choose the option that disallows indexing (noindex).
Open the page in the editor and find the SEO plugin's panel.
Find the advanced or robots meta setting and switch the page to noindex.
Update the page and clear any page cache.
View the live page source and confirm there is exactly one robots meta tag containing noindex.
Verify the output rather than trusting the toggle. Themes and other plugins sometimes add a second robots tag that contradicts the first.
Method 2: core robots filter
Since WordPress 5.7, core builds the robots meta tag through the wp_robots filter. You can add noindex for specific pages in a small plugin or in a theme's functions.php (use a child theme or a site-specific plugin so updates do not overwrite it):
Core also ships a helper, wp_robots_no_robots, which you can hook to apply noindex site-wide in non-production environments. Adjust for your needs and test on staging.
Method 3: send a header
For non-HTML files, or for rules by URL pattern, use the X-Robots-Tag header at the server or CDN level. In PHP code you can also send it from a hook:
add_action( 'send_headers', function () {
if ( is_page( 'thank-you' ) ) {
header( 'X-Robots-Tag: noindex', true );
}
} );
Method 4: delete the page
If nobody needs the page, move it to Trash and empty the Trash. WordPress then returns a 404 for the URL. If an equivalent page exists, add a 301 redirect with your redirect plugin or hosting rules. For a 410, use a redirection plugin or a server rule. See 404 vs 410. Remove the page from menus, widgets and internal links.
The "Discourage search engines" setting
WordPress has a site-wide setting under Settings, Reading, described in the WordPress documentation for the Reading screen, which asks search engines not to index the site. Use it for development sites only. It is a request, not a lock, and if left on after launch it removes your whole site from search. Always confirm it is off on the live site, and protect development sites with authentication. See staging and dev sites.
Clean up the archive and utility pages
WordPress generates many URLs you did not write. Review these:
Author archives on single-author sites: noindex or redirect where appropriate.
Date archives: noindex.
Attachment pages: redirect to the parent or file, or noindex.
Paginated and comment-reply URLs: review canonical behaviour.
Category archives that are useful: keep indexable.
Sitemaps and canonicals
WordPress generates an XML sitemap, and SEO plugins can replace it with their own. After you noindex a page, make sure the sitemap no longer lists it. Plugins usually exclude noindexed pages automatically; check the sitemap file itself to confirm. The canonical tag should not point to a different URL if the page is noindex. See canonical tags and deindexing.
Caching and CDN gotchas
Page caching, optimisation plugins and CDNs can serve an old HTML version without your tag. After any change, clear the plugin cache and the CDN cache, then request the page with a cache-busting query string and with curl. Googlebot may be served cached HTML, so what matters is the response outsiders get.
Verify
Check the live HTML for one robots tag with noindex, or the header with curl -I.
Confirm robots.txt does not block the page.
Inspect the URL in Search Console and request indexing to prompt a recrawl.