feat: check wp_supports_ai() before initializing experiments#268
feat: check wp_supports_ai() before initializing experiments#268justlevine wants to merge 4 commits intodevelopfrom
wp_supports_ai() before initializing experiments#268Conversation
|
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 If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Labeled this |
There was a problem hiding this comment.
Pull request overview
Adds an explicit AI-capability gate so the plugin does not initialize (and instead informs admins) when WordPress has AI support disabled via wp_supports_ai().
Changes:
- Introduces
check_ai_support()to detect disabled AI support and register an admin notice. - Updates
load()to include the AI support check alongside PHP/WP version requirements.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #268 +/- ##
=============================================
- Coverage 57.48% 57.22% -0.26%
Complexity 563 563
=============================================
Files 35 35
Lines 2907 2920 +13
=============================================
Hits 1671 1671
- Misses 1236 1249 +13
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Overall, this looks good. It needs to be brought up today after the core patch lands. |
|
Punting to 0.7.0 as we'll likely get 0.6.0 out before RC1 / when the linked Trac ticket will get to a resolution. |
|
Now that the upstream PR/patch has been merged, @justlevine @dkotter do we want to refresh this PR such that Features and Experiments that rely on an LLM are disabled respectively? Something like Abilities Explorer still seems like something that could be enabled. |
What?
Part of https://core.trac.wordpress.org/ticket/64706
This PR adds a check for
wp_supports_ai()before initializing specific AI experiments.Why?
wp_supports_ai()will allow for sites to completely disable AI functionality via aWP_AI_SUPPORTconstant and thewp_supports_aifilter. Our plugin should respect that.wp_supports_ai()and related constant + filter wordpress-develop#11149How?
Currently the check happens in
bootstrap.phpand prevents the entire plugin from loading, due to implementation details from the 0.1.0. scaffold that make it unwieldy to check on a per-experiment level.While technically there can be Experiments (less likely full-on Features) that don't require AI to run (e.g. the Abilities Explorer), since we'll anyway need to refactor a significant about of boilerplate for the transition to canonical
AI pluginit seems like a waste to detangle now.The admin notice triggers on both
admin_noticesandnetwork_admin_notices. Assumedly it's an unintentional omission on the other notices from the initial implementation, that should also be handled during the aforementioned cleanup.Use of AI Tools
N/A
Testing Instructions
wp_supports_ai()and related constant + filter wordpress-develop#11149define( 'WP_AI_SUPPORT', false );in yourwp-config.phpand ensure you see an admin notice and the plugin doesn't load.Testing Instructions for Keyboard
Screenshots or screencast