Skip to content

Environments: Define GLOTPRESS_TABLE_PREFIX for the Plugin Directory - #1081

Draft
obenland wants to merge 1 commit into
WordPress:trunkfrom
obenland:fix/plugins-env-glotpress-prefix
Draft

obenland wants to merge 1 commit into
WordPress:trunkfrom
obenland:fix/plugins-env-glotpress-prefix

Conversation

@obenland

Copy link
Copy Markdown
Member

Since r15362 (#1064), Plugin_I18n::get_locales() reads translation progress straight from the GlotPress tables instead of calling the translate.wordpress.org API. It runs on every plugin page, through the hreflang links in wp_head. The plugin-directory environment never defined GLOTPRESS_TABLE_PREFIX, so every single-plugin page dies locally:

Uncaught Error: Undefined constant "WordPressdotorg\Plugin_Directory\GLOTPRESS_TABLE_PREFIX"
in plugin-directory/class-plugin-i18n.php:156

This sets the constant to production's translate_ prefix. The shared mocks/mu-plugins/wporg-query-filter.php already short-circuits translate_* queries, so get_gp_branch_id() finds no project and get_locales() returns an empty list. That's the same result the old API call gave locally when it failed.

No other environment reaches this code.

Testing

  1. npm run plugins:env start, then open any imported plugin, for example http://localhost:8888/akismet/.
  2. On trunk the page shows the fatal error above. With this change it renders with no errors.

I verified it by defining the constant in a running environment. Two plugin pages that were failing returned 200, with no PHP fatal and no database error.

Related

The support-forums environment also crashes when it's restarted with a changed config (--xdebug, --update). That one is a wp-env bug: re-extracting a zip core deletes wp-config.php. It's being fixed upstream in WordPress/gutenberg#85235 and needs no change here.

🤖 Generated with Claude Code

Since r15362, Plugin_I18n::get_locales() reads translation progress from
the GlotPress tables instead of the translate.wordpress.org API. It runs on
every plugin page through the hreflang links, and without the constant
those pages die with a fatal error locally. With the production prefix,
the shared query filter short-circuits the translate_* queries, so the
locales come back empty as they did when the API call failed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 20, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

1 participant