Disable 'Correct spelling and grammar' toolbar option by default#47916
Disable 'Correct spelling and grammar' toolbar option by default#47916
Conversation
Gate the "Correct spelling and grammar" quick edit behind a new ai_correct_spelling_enabled filter (default false). This hides the option from both the AI Assistant toolbar dropdown and the prompt templates control menu. Re-enable per-site with: add_filter( 'ai_correct_spelling_enabled', '__return_true' ); Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! Jetpack plugin: No scheduled milestone found for this plugin. If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
There was a problem hiding this comment.
Pull request overview
This PR disables the “Correct spelling and grammar” option in Jetpack’s AI Assistant UI by default, while allowing it to be re-enabled via a new PHP filter controlling the ai-correct-spelling extension availability.
Changes:
- Gate
ai-correct-spellingextension availability behind a newai_correct_spelling_enabledfilter (defaultfalse). - Hide the “Correct spelling and grammar” entry from both the AI Assistant toolbar dropdown quick actions and the “Write with AI” prompt templates menu when unavailable.
- Register
ai-correct-spellingin the Jetpack extensions production list and add a changelog fragment.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| projects/plugins/jetpack/extensions/index.json | Adds ai-correct-spelling to the production extensions list. |
| projects/plugins/jetpack/extensions/blocks/ai-assistant/components/prompt-templates-control/index.tsx | Conditionally renders the “Correct spelling and grammar” menu item based on feature availability. |
| projects/plugins/jetpack/extensions/blocks/ai-assistant/components/ai-assistant-toolbar-dropdown/dropdown-content.tsx | Filters out the “Correct spelling and grammar” quick action when the feature is unavailable. |
| projects/plugins/jetpack/extensions/blocks/ai-assistant/ai-assistant.php | Introduces the ai_correct_spelling_enabled filter and gates extension registration. |
| projects/plugins/jetpack/changelog/disable-correct-spelling-option | Documents the default-disable behavior via a changelog fragment. |
| /** | ||
| * Internal dependencies | ||
| */ | ||
| import { getFeatureAvailability } from '../../lib/utils/get-feature-availability'; | ||
| import { __ } from '@wordpress/i18n'; | ||
| import { title, postContent, postExcerpt, termDescription, post, pencil } from '@wordpress/icons'; |
There was a problem hiding this comment.
The new internal import is splitting the “External dependencies” import group: @wordpress/i18n and @wordpress/icons are external but now appear after the internal-deps block. Please reorder so all external imports remain together, then the internal-dependencies section (and keep the section comment style consistent).
| /** | |
| * Internal dependencies | |
| */ | |
| import { getFeatureAvailability } from '../../lib/utils/get-feature-availability'; | |
| import { __ } from '@wordpress/i18n'; | |
| import { title, postContent, postExcerpt, termDescription, post, pencil } from '@wordpress/icons'; | |
| import { __ } from '@wordpress/i18n'; | |
| import { title, postContent, postExcerpt, termDescription, post, pencil } from '@wordpress/icons'; | |
| /* | |
| * Internal dependencies | |
| */ | |
| import { getFeatureAvailability } from '../../lib/utils/get-feature-availability'; |
| Comment: Disable the 'Correct spelling and grammar' option from AI Assistant toolbar menus by default. It can be re-enabled via the 'ai_correct_spelling_enabled' filter. | ||
|
|
||
| AI Assistant: Disable the "Correct spelling and grammar" toolbar option by default. |
There was a problem hiding this comment.
This changelog fragment includes a Comment: header even though an entry text is present below. In the Jetpack changelog fragments, Comment: is typically used only when there is no entry text (e.g., carousel-remove-medium, update-newsletter-panel-title-no-i18n). Consider removing the Comment: header and incorporating any needed context into the entry text instead.
| Comment: Disable the 'Correct spelling and grammar' option from AI Assistant toolbar menus by default. It can be re-enabled via the 'ai_correct_spelling_enabled' filter. | |
| AI Assistant: Disable the "Correct spelling and grammar" toolbar option by default. | |
| AI Assistant: Disable the "Correct spelling and grammar" toolbar option by default. It can be re-enabled via the `ai_correct_spelling_enabled` filter. |
Code Coverage SummaryCoverage changed in 3 files.
|
Address Copilot review feedback and CI failures: - Fix import order: move internal import after all external @WordPress imports - Fix prettier formatting of multi-line filter condition - Remove invalid Comment: header from changelog and use 'other' type - Incorporate filter details into changelog entry text Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Correct tab indentation on the parenthesized filter condition to match prettier's expected output. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@claude please review |
|
Claude finished @saroshaga's task in 1m 36s —— View job PR Review
Overall this is a clean, well-scoped PR that correctly follows the established pattern for gating AI features behind PHP filters. Here are my observations: PHP —
|
Summary
ai_correct_spelling_enabledPHP filter (defaultfalse), following the same pattern used by other AI features likebreve_enabledandai_seo_enhancer_enabledMore Context
Changes
ai-assistant.php: Added newai_correct_spelling_enabledfilter (defaultfalse) that controlsai-correct-spellingextension availabilityextensions/index.json: Registeredai-correct-spellingas a production extensiondropdown-content.tsx: Added feature availability check to filter out "Correct spelling and grammar" from quick actions when disabledprompt-templates-control/index.tsx: Added feature availability check to conditionally render the "Correct spelling and grammar" menu itemRe-enabling
To re-enable the feature, add this filter:
```php
add_filter( 'ai_correct_spelling_enabled', '__return_true' );
```
Testing instructions:
Does this pull request change what data or activity we track or use?
No. This PR only changes the default visibility of an existing UI option. No new data collection, tracking, or privacy-related changes are introduced.
🤖 Generated with Claude Code