Skip to content

feat: check wp_supports_ai() before initializing experiments#268

Open
justlevine wants to merge 4 commits intodevelopfrom
feat/wp_supports_ai
Open

feat: check wp_supports_ai() before initializing experiments#268
justlevine wants to merge 4 commits intodevelopfrom
feat/wp_supports_ai

Conversation

@justlevine
Copy link
Contributor

@justlevine justlevine commented Mar 4, 2026

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 a WP_AI_SUPPORT constant and the wp_supports_ai filter. Our plugin should respect that.

How?

  • Currently the check happens in bootstrap.php and 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 plugin it seems like a waste to detangle now.

  • The admin notice triggers on both admin_notices and network_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

  1. Checkout fix: add wp_supports_ai() and related constant + filter wordpress-develop#11149
  2. Set define( 'WP_AI_SUPPORT', false ); in your wp-config.php and ensure you see an admin notice and the plugin doesn't load.

Testing Instructions for Keyboard

Screenshots or screencast

Before After
Open WordPress Playground Preview

@justlevine justlevine added the [Status] Blocked Used to indicate unable to move forward label Mar 4, 2026
@justlevine justlevine requested a review from Copilot March 4, 2026 22:06
@github-actions
Copy link

github-actions bot commented Mar 4, 2026

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 props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: justlevine <[email protected]>
Co-authored-by: gziolo <[email protected]>
Co-authored-by: jeffpaul <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@justlevine
Copy link
Contributor Author

Labeled this blocked until https://core.trac.wordpress.org/ticket/64706 is in core.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@justlevine justlevine requested a review from dkotter March 4, 2026 22:27
@codecov
Copy link

codecov bot commented Mar 4, 2026

Codecov Report

❌ Patch coverage is 0% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 57.22%. Comparing base (3b059d9) to head (81716cf).

Files with missing lines Patch % Lines
includes/bootstrap.php 0.00% 14 Missing ⚠️
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     
Flag Coverage Δ
unit 57.22% <0.00%> (-0.26%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jeffpaul jeffpaul added this to the 0.5.0 milestone Mar 4, 2026
@jeffpaul jeffpaul modified the milestones: 0.4.1, 0.5.0, 0.6.0 Mar 6, 2026
@gziolo
Copy link
Member

gziolo commented Mar 16, 2026

Overall, this looks good. It needs to be brought up today after the core patch lands.

@jeffpaul
Copy link
Member

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.

@jeffpaul jeffpaul modified the milestones: 0.6.0, 0.7.0 Mar 18, 2026
@jeffpaul
Copy link
Member

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.

@justlevine
Copy link
Contributor Author

@jeffpaul next item on my cleanup list is the Bootstrapper. between that and the changes in #316 I think we're in a good place to only disable AI specific functionality before WP7.0 🤞

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Status] Blocked Used to indicate unable to move forward

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

4 participants