How Can I Modify the List of Staging URLs?

A staging site is a clone of your live website. Developers and regular users often use staging sites as a sandbox where they can test new plugins, themes, and setups safely, preventing errors from occurring on live sites. In other words, they basically enable you to test any change or major feature in a secure environment.

Possible Issues with Nelio Content and Live/Staging Sites

Nelio Content is a WordPress plugin that relies on a cloud service for performing its tasks. In order to communicate with each other, the plugin must store some information in the WordPress database that links a certain site to our cloud. Usually, this information should be never cloned from one site to another, but that’s exactly what staging sites do—if you create a staging site all the information stored in the live site will be cloned to the new staging site. This might generate some conflicts, for both sites will be able to modify any data stored in the cloud.

For instance, let’s assume that you have a scheduled post for next Tuesday, along with several social messages to promote it. Usually, when the post is published in WordPress, our plugin will send an event to our cloud letting it know that “this post has already been published”. As a result, our cloud is now allowed to send all the promoting social messages, when their time comes.

Now let’s assume that, before the post is published, we create a staging site. In this case, there are two scheduled posts: one live, and one staging. They’re supposed to be published at the exact same time (for one site is an exact copy of the other). When the posts are published, our cloud gets and processes two notifications. If the last notification our cloud processes is the staging’s, then all the links included in the scheduled social messages won’t point to your live site, but to staging.

Solution

To overcome this and other similar issues, our plugin will consider as a “staging site” any site whose home URL contains one of the strings included in a list of “staging keywords” or “staging URLs”. When the plugin is running in a staging site, it behaves as if it were completely disabled and the following message appears in the plugin list:

Staging Site Warning
If Nelio Content considers the current site as a Staging site, you’ll see this warning in your list of installed plugins.

Nelio Content Reports My Site as a Staging Site. How Do I Fix This?

By default, any site that contains the word staging will be considered a staging site. For example, you won’t be able to use Nelio Content in a plugin whose URL is https://staging.domain.com. If your site is reported as a staging site, when it isn’t, create a file named nelio-content-staging.php with the following content and upload it into your WordPress site using an FTP program, under wp-content/mu-plugins/nelio-content-staging.php:

With the previous MU-plugin, Nelio Content will no longer consider your site as a staging site and you’ll be able to use all Nelio’s features.

How Do I Modify the Staging Keywords/URLs, so that Nelio Content is Automatically Disabled on Staging?

If your staging sites don’t include the word staging but other words (such as, for example, testing or .dev), you can tweak the previous function so that it includes those keywords:

This way, URLs such as local.wordpress.dev or testing.domain.com will be considered staging sites and Nelio Content will be automatically disabled on those sites.