We'll create fresh WordPress site with Set the Stage installed. You have 20 minutes to test the plugin after that site we'll be deleted.
Adds a menu to the admin bar to quickly identify different environments for a site (e.g. production and development) and easily switch to the same URL on other environments. Multi-site compatible for both sub-domain and sub-directory installations.
The plugin has a convenient settings page but can also be configured programatically via a filter hook.
Navigate to “Settings > Set the Stage” in the WordPress admin to review and edit the configuration.
Hook to drgnff_wp_stage_switcher__environments
and return an array with environments. Here’s an example filter function:
add_filter( 'drgnff_wp_stage_switcher__environments', function ($envs) {
return [
[
'url' => 'https://example.com', // home url
'title' => 'LIVE', // display name
'color' => '#ffffff', // hex color (optional)
'background_color' => '#ff0000', // hex color (optional)
],
[
'url' => 'https://example.com',
'title' => 'DEVELOPMENT',
'color' => '#ffffff',
'background_color' => '#228b22',
],
];
});
By default the switcher menu is displayed to all logged in users. By hooking to drgnff_wp_stage_switcher__should_display_switcher
and returning a boolean you can control whether the switcher should be displayed.
The default environment is used for the current site if it’s not in the list of environments. By hooking to drgnff_wp_stage_switcher__default_environment
you can control the title and colors for the default environment.
plugins_loaded
hook with priority 11
. Thus filter hooks that affect the plugin must be added before that.