Skip to content

fix(wordpress): map app.env to WP_ENVIRONMENT_TYPE - #444

Merged
ogorzalka merged 2 commits into
Pollora:release/v13.36.0from
Boulea7:hotfix/443-wordpress-environment
Oct 14, 2026
Merged

ogorzalka merged 2 commits into
Pollora:release/v13.36.0from
Boulea7:hotfix/443-wordpress-environment

Conversation

@Boulea7

@Boulea7 Boulea7 commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Map Laravel's app.env to a default WP_ENVIRONMENT_TYPE before WordPress loads, so app.env=local produces local. The mapping also handles dev, development, testing, and staging, while preserving explicit process environment values, configured constants, and constants that are already defined.

Fixes #443.

The documentation submodule points to the companion documentation PR. Its commit is based on current docs main, so it also advances the older documentation snapshot.

Passed individually on PHP 8.4 with memory_limit=1G:

  • composer test:refacto -- --debug
  • composer test:lint
  • composer test:types
  • composer test:unit: 1990 tests, 4012 assertions, including 28 new environment regression cases.
  • composer test:type-coverage: 99.2%.

The regression cases exercise the real bootstrap and constant manager with the repository's WordPress stubs. DDEV and WordPress core integration were not run.

Map Laravel's app.env to a default WP_ENVIRONMENT_TYPE before WordPress loads, so
app.env=local produces local. dev, development, testing and staging are mapped too;
an explicit process environment value, a configured constant or a constant already
defined still wins.

Fixes Pollora#443.
@ogorzalka
ogorzalka force-pushed the hotfix/443-wordpress-environment branch from 3ceb337 to 830eeb6 Compare October 13, 2026 17:29
@ogorzalka
ogorzalka changed the base branch from develop to release/v13.36.0 October 13, 2026 17:30
@ogorzalka

Copy link
Copy Markdown
Member

Thanks for the fix and the thorough tests: the mapping matches #443 exactly. To land it in v13.36.0 I rebased your commit (authorship kept) onto release/v13.36.0, retargeted the PR, and made two changes:

  • dropped the documentation submodule bump: we only point it at documentation's merged main, in a dedicated commit at release time, and 3fd2997 lives on the companion PR's branch only;
  • added the CHANGELOG entry.

Checked on a Pollora site: wp_get_environment_type() goes from production to local, and a WP_ENVIRONMENT_TYPE environment variable still wins. The docs PR will follow once this is merged.

…utside production

The site now reports its environment as local, so the trackback test needs the
wp_should_disable_pings_for_environment filter. The changelog says what the new
environment changes for pings.
@ogorzalka
ogorzalka merged commit 6415fdd into Pollora:release/v13.36.0 Oct 14, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants