Assuming this is an XY problem and the original question is: “How do I block crawlers from indexing my staging site?”
Staging and production should be as close as similar. Having changes in code would be a big “no no” for me (except for some environment variables, e.g. setting WP_ENVIRONMENT_TYPE
or db credentials).
Instead, I would suggest setting up the webserver to serve the X-Robots-Tag
with noindex
. There was some discussion which takes preference if you have both (X-Robots-Tag
and <meta name="robots" />
), but in my experience it suffices to have X-Robots-Tag: none
to not have the sites indexed, even if their own <meta name="robots" />
differs.
Related Posts:
- Display Yoast WordPress SEO title in archive template
- How to add a page to the Yoast breadcrumbs
- How to print meta description to posts? [closed]
- Removing “Noindex, follow” from pages [closed]
- Why do I get a 404 for my sitemap index after installing Yoast? [closed]
- Change content language for one page
- Add Page number to Meta Description in WordPress SEO by Yoast [closed]
- Manipulating wp_head content
- Yoast’s WordPress SEO plugin is not showing the correct snippet [closed]
- XML Sitemap : broken XML file [closed]
- make the url unlimited
- Query Post Based of Yoast Primary Category Class
- Wrong Canonical url link
- When does the Yoast SEO filter hook wpseo_sitemap_urlimages fire?
- How to parse Yoast SEO Snippet Variables
- Post content blank after disabling Yoast SEO
- With the Yoast SEO plugin, is it possible to make the meta description a required form field?
- WP-RestAPI and xml sitemap
- help to write a custom php script to settingup yoast priority to pages or posts
- Yoast Seo Plugin – Set no-index to a post automatically when a post is set to sticky [closed]
- Yoast SEO Plugin: Double Title isse [closed]
- Yoast SEO creates sitemaps with a dash ‘-‘ but I can’t get Bing to accept them [closed]
- Edit title-tag in wp_head with yoast seo
- Way to change the Yoast Schema depending on post type? [closed]
- Change base URL of Yoast Sitemap [closed]
- Variable focus word YOAST
- How can I add a second Open Graph image to a site using Yoast? [closed]
- How to call Yoast Seo Tags without needing to call the whole wp_head?
- My WordPress website has 2 header [closed]
- Add content before Yoast description
- Twenty Eleven Theme – SEO Yoast duplicate site titles
- Add Page number to Meta Description in WordPress SEO by Yoast [closed]
- Blog home page has canonical link that is incorrect. Do not see where to change this
- How to Modify Breadcrumb Page Names for Specific Pages? [closed]
- P3 Profiler and Yoast SEO plugin
- WordPress site running on Yoast not being indexed into Google News [closed]
- How to use the Yoast SEO wpseo_canonical filter to set a canonical URL for /, /au/ & /uk/ sites in a MU environment
- Yoast Metadata API to adjust/override the meta description
- Fixing link rel=”next” in Yoast SEO for paginated links
- how to disable Yoast SEO schema from homepage only?
- WPML and Yoast SEO setup on a wordpress site is not working properly
- Remove canonical link element from noindex pages
- What could be causing the category to be appearing as the post title in the title tag?
- Changing Post Sitemap Frequency to Hourly [closed]
- Turn off auto 301 on archive pages? [closed]
- Yoast: do I still need to manually insert meta tags in my theme or will Yoast do this for me? [closed]
- Hard-code SEO Title defaults across all sites on a multisite
- WordPress site using Yoast SEO being blocked from indexing by robots.txt
- SEO Yoast Menu Not working
- Wrong Open Graph image is shown (og:image) using yoast
- An inactive plugin causes an HTTP 404 issue on a translated post – WPML
- Set default image for twitter cards with Yoast?
- Overwriting yoast’s og:meta output?
- yoast seo plugin – remove bulk title and description editor menu from non-admins [closed]
- Yoast SEO makes repeated INSERT queries loading any page
- how to add urls dynamically into the sitemap
- yoast sitemap xml
- Change Paginated Blog Canonicals
- Preview Problem Yoast SEO
- Remove all author names from yoast meta
- My wordpress website showing 2 titles in source code how can i fix this issue
- Separate Sitemaps for Each Language with Polylang and Yoast SEO
- How to display Yoast SEO meta description in archive template for each post instead of the_excerpt()? [closed]
- Using php to overwrite or replace title tag, while using yoast [closed]
- WordPress SEO by Yoast: Hide Meta Boxes in Posts for Non-admins
- Remove the Yoast SEO Post Metabox [closed]
- Remove an action from an external Class
- How to roll back a WordPress plugin update?
- Advanced Custom Fields and Yoast SEO keyword analysis [closed]
- How can I modify the Capability needed to access a plugin’s options?
- Allowing Yoast SEO plugin to track me
- Set Custom Post feature image as og:image
- Custom Yoast Breadcrumbs URL
- Add a meta description to home page?
- Is checking whether the blog is installed necessary?
- root-relative links for multiple parked domains
- Set Primary category using the Yoast SEO plugin
- Exclude custom post_type in sitemap generation?
- Inserting Post Using wp_insert_post. How to Fill Yoast Plugin SEO Fields
- add post content in meta description in yoast
- Yoast SEO breadcrumbs: how to create a filter that uses the url slug for breadcrumb titles
- How to use Yoast SEO backend in english even if WPLANG variable is not english?
- SEO meta description and title tag Yoast SEO
- htaccess: Remove trailing slash from URL ending with .xml/ only
- Yoast SEO Calling content filters 2 additional times
- remove rel=next on home page but not others
- Using ‘Primary Category’ in URL
- Yoast SEO blocking/re-initialising longer running process
- Can’t access my WP dashboard: fatal error? [closed]
- Hide Meta Boxes for Non-Admins
- Why doesn’t YoastSEO allow me to set the title/description for the home page? [closed]
- How do I get WordPress URL rewrites into Sitemap?
- Getting yoast title for custom taxonomy
- Yoast Sitemap grouping external sitemaps [closed]
- Custom WP TItle from custom template with dynamic URL structure
- Yoast SEO hooks overriding themselves
- Open graph problem: Showing wrong description of homepage while sharing on Facebook [closed]
- Can I change the contents of a description meta tag generated by Yoast?
- Add custom taxonomy to title tag [closed]
- Adding multiple taxonomy filters to functions.php