Skip to content
Open
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
7ff6888
fix: add `wp_supports_ai()` and related constant + filter
justlevine Mar 4, 2026
26d6c92
Merge remote-tracking branch 'upstream' into fix/wp_supports_ai
justlevine Mar 4, 2026
3aa0aae
fix: resolve merge conflicts
justlevine Mar 4, 2026
941cc8b
dev: rename const to WP_AI_SUPPORT
justlevine Mar 4, 2026
78b010b
tests: gate `ReflectionProperty::setAccessible()`
justlevine Mar 4, 2026
a5cef8e
Apply suggestions from code review
justlevine Mar 7, 2026
98b881f
chore: phpcbf
justlevine Mar 7, 2026
e47bedb
Merge branch 'trunk' into fix/wp_supports_ai
justlevine Mar 11, 2026
3ee6aaa
chore: feedback
justlevine Mar 11, 2026
d4b8da5
Merge branch 'trunk' into fix/wp_supports_ai
justlevine Mar 11, 2026
a2d738f
Reuse Prompt type from PromptBuilder in WP_AI_Client_Prompt_Builder c…
westonruter Mar 11, 2026
95a827a
Fix PHPStan error about non-callable being returned
westonruter Mar 11, 2026
b3f04fd
Add type hint for _wp_connectors_register_default_ai_providers()
westonruter Mar 11, 2026
f7f754d
Remove blank line
westonruter Mar 11, 2026
5a06aea
Add void return types
westonruter Mar 11, 2026
2b05524
Remove needless assertion since _wp_connectors_get_connector_settings…
westonruter Mar 11, 2026
ffc7e32
Merge branch 'trunk' into fix/wp_supports_ai
justlevine Mar 12, 2026
414588a
Merge branch 'trunk' into fix/wp_supports_ai
justlevine Mar 12, 2026
d0b4a03
chore: lint after merging
justlevine Mar 12, 2026
007b572
chore: fix test and cleanup
justlevine Mar 12, 2026
bb965aa
Merge branch 'trunk' into fix/wp_supports_ai
justlevine Mar 12, 2026
eda3323
fix: check for support in __call()
justlevine Mar 12, 2026
e0719a0
Merge branch 'trunk' into fix/wp_supports_ai
justlevine Mar 16, 2026
e8387df
chore: post merge cleanup
justlevine Mar 16, 2026
bd314e7
Merge branch 'trunk' into fix/wp_supports_ai
justlevine Mar 16, 2026
9773705
tests: test `Registry->get_all_registered()` instead of downstream
justlevine Mar 16, 2026
069e6d4
chore: revert `__call()` check in favor of constructor
justlevine Mar 16, 2026
4f43aad
chore: move support check to __call()
justlevine Mar 18, 2026
0d1ffb9
tests: remove unnecessary test
justlevine Mar 18, 2026
9126d8b
dev: allow filter to override constant
justlevine Mar 18, 2026
bcb364b
Merge branch 'trunk' into fix/wp_supports_ai
justlevine Mar 18, 2026
f0c1632
fix: prevent filter from overriding WP_AI_SUPPORT preference
justlevine Mar 19, 2026
6afd7c1
Merge branch 'trunk' into fix/wp_supports_ai-constants-order
justlevine Mar 24, 2026
aed6303
Update src/wp-includes/ai-client.php
justlevine Mar 24, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/wp-includes/ai-client.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
* @return bool Whether AI features are supported.
*/
function wp_supports_ai(): bool {
$is_enabled = defined( 'WP_AI_SUPPORT' ) ? WP_AI_SUPPORT : true;
// Return early if AI is disabled by the current environment.
if ( defined( 'WP_AI_SUPPORT' ) && ! WP_AI_SUPPORT ) {
return false;
}

/**
* Filters whether the current request should use AI.
Expand All @@ -27,10 +30,9 @@ function wp_supports_ai(): bool {
*
* @since 7.0.0
*
* @param bool $is_enabled Whether the current request should use AI. Default to WP_AI_SUPPORT constant, or true if
* the constant is not defined.
* @param bool $is_enabled Whether the current request should use AI. Default to true.
*/
return (bool) apply_filters( 'wp_supports_ai', $is_enabled );
return (bool) apply_filters( 'wp_supports_ai', true );
}

/**
Expand Down
Loading