Connectors: Fix AI plugin settings page link to use the ai-wp-admin slug#11614
Connectors: Fix AI plugin settings page link to use the ai-wp-admin slug#11614itzmekhokan wants to merge 2 commits intoWordPress:trunkfrom
ai-wp-admin slug#11614Conversation
…p-admin` slug.
The "Control features in the AI plugin" button on the Options → Connectors
screen was linking to `options-general.php?page=ai`, which triggers a
"you do not have sufficient permissions" error because the AI plugin now
registers its settings page under the slug `ai-wp-admin`.
The `AI_PLUGIN_SLUG` constant is still needed as-is for the plugin install
call (`saveEntityRecord( 'root', 'plugin', { slug: AI_PLUGIN_SLUG, ... } )`),
which must use the wp.org plugin directory slug `ai`. A separate constant,
`AI_PLUGIN_PAGE_SLUG`, is introduced for the admin settings page slug and
used only at the settings link use-site.
Variable naming matches the upstream Gutenberg source-of-truth PR
(WordPress/gutenberg#77336), so these built-file changes line up with what
core will receive via the next Gutenberg sync.
Props dkotter, JeffPaul, nimeshatxecurify, ocean90.
Fixes #65073.
Made-with: Cursor
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @1178653+wordpress-develop-pr-bot[bot]@users.noreply.github.com. Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases. Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Cross-reference: there is an earlier open PR for the same Trac ticket — #11576 — which introduces the constant as This PR uses the name |
Trac ticket: https://core.trac.wordpress.org/ticket/65073
Summary
On Options → Connectors, after the AI plugin is installed and activated, the "Control features in the AI plugin" button links to
options-general.php?page=ai. The AI plugin now registers its admin page under the slugai-wp-admin, so the old URL produces a "you do not have sufficient permissions to access this page" error.The
AI_PLUGIN_SLUG = "ai"constant is used in two different contexts inroutes/connectors-home/ai-plugin-callout.tsx:saveEntityRecord( 'root', 'plugin', { slug: AI_PLUGIN_SLUG, status: 'active' } )to install the plugin — this must stay"ai".addQueryArgs( 'options-general.php', { page: AI_PLUGIN_SLUG } )— this is the broken one and must be"ai-wp-admin".A single-value rename would break the install call, so this patch introduces a separate constant
AI_PLUGIN_PAGE_SLUG = "ai-wp-admin"and uses it only at the settings-link use-site.The variable name matches the upstream source-of-truth PR in Gutenberg (WordPress/gutenberg#77336), so these built-file changes line up with what core will receive via the next Gutenberg sync.
Changes
src/wp-includes/build/routes/connectors-home/content.js— addAI_PLUGIN_PAGE_SLUG = "ai-wp-admin"and use it for thepage:query arg on the settings link.src/wp-includes/build/routes/connectors-home/content.min.js— same behavioral change (minified); the literal"ai-wp-admin"is inlined at the single use-site to avoid adding a new minified identifier, while the existingMt="ai"is preserved for the install call.Test plan
wp-admin/options-general.php?page=ai-wp-adminand loads the plugin's settings page (no permissions error).aiis unchanged for that path).Related
AI_PLUGIN_ADMIN_SLUG)Props dkotter, JeffPaul, nimeshatxecurify, ocean90.
Made with Cursor