Home

Profenv – Environment Profiles is a WordPress plugin that stores environment-specific values (such as a GTM container ID and a GA4 measurement ID) for each of your environments and switches them automatically based on the environment the site is currently running in. It solves the common migration problem where production settings cannot be reused on staging, and vice versa.

Environment detection uses a four-step fallback: a custom constant, WP_ENVIRONMENT_TYPE, domain mapping, and undetermined as the last resort. When the environment cannot be determined, output of environment-specific values is suspended and a warning is shown in the admin screen, so staging tags can never fire on production.

Download on WordPress.org

Usage

Go to Settings → Environment Settings, define your environment sets (production, staging, and more) and the shared fields (the defaults gtm_id / ga4_id), then enter a value on each environment tab. When gtm_id / ga4_id hold a value, the core plugin outputs the tags automatically. The detection method (custom constant / WP_ENVIRONMENT_TYPE / domain mapping) is selected on the “Environments & Detection” tab.

Read the usage guide →

Documentation (for developers)

The public API profenv_current_env() / profenv_get() / profenv_get_all() (each with a filter equivalent), the read-only bridge that exposes shared field values through get_option( 'profenv_<key>' ) and ACF’s get_field(), and registering custom fields via the profenv_register_fields filter.

Read the documentation →

FAQ

“What happens when the environment is not determined?”, “Can I use it without editing wp-config.php?”, “Are stored code snippets output?”, “Is any data sent to Google?” and more.

Read the FAQ →

Changelog

The latest stable version is 0.7.1, which renames the admin menu entry to “Environment Settings”, defaults the staging detection domain to the current domain while no environment sets have been saved, and fixes the “Settings saved.” notice being displayed twice. See the changelog for details of every version.

View the changelog →

Requirements

WordPress5.5 or higher (tested up to 7.0)
PHP7.4 or higher
LicenseGPLv2 or later
Copied title and URL