Profenv stores environment-specific values (such as a GTM container ID and a GA4 measurement ID) for each of your environments (production, staging, and any additional sets) 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.
- Four-step fallback environment detection: custom constant (wp-config.php), WP_ENVIRONMENT_TYPE (WP 5.5+), 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. This prevents staging tags from ever firing on production
- Field definitions (key and type, including code snippets) are shared across all environments, while each environment stores its own values
- Each environment can also define environment-specific fields (key, type, and value) that exist only in that environment
- When keys named gtm_id / ga4_id are defined and filled, the core plugin automatically outputs the GTM / GA4 tags with proper escaping; all other values are stored only and never output by the core plugin
- Public API for extensions and themes: profenv_current_env(), profenv_get(), and profenv_get_all(), each with a filter equivalent that returns a safe default when the plugin is inactive
- Shared field values are also readable through the standard option API — get_option( 'profenv_gtm_id' ) — and through ACF's get_field() with the same prefixed name, always returning the current environment's value
- Extensions can register their own fields via the profenv_register_fields filter and reuse the settings infrastructure