Wordpress - easy way to prevent staging server from indexing?

Hello!

I’m wondering if there’s an easy method of disabling or preventing indexing of a staging server.

We’re using the Wordpress plugin and cloning the live site to staging, which is more of a testing server than one that is ‘pushed’ back to live, for various reasons I’d rather not get into.

The staging server is reindexing, using a different prefix (site_staging) for the indices, so we’re not only using more indexing than necessary, but sometimes those staging indices are showing up on the live site.

Do I simply have to disable the plugin every time I push a new copy to staging?

Hi @keith,

One option could be as you suggested, yes: Do I simply have to disable the plugin every time I push a new copy to staging?

Another option is if you can have conditional code run depending on whether you are pushing to the staging or production server.

I can be honest and say that I do not know the exact method to implement this because the Algolia for WordPress plugin was designed for automated indexing.

However, if you can conditionally run code on push to staging, then perhaps you can leverage a code snippet similar to this: How to exclude pages from search results

It will be an all inclusive use of the snippet to exclude all post-types from being indexed.

I hope this helps!