You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In WordPress 7.0 there is this new function for hosts and plugins to completely disable any AI features:
/**
* Returns whether AI features are supported in the current environment.
*
* @since 7.0.0
*
* @return bool Whether AI features are supported.
*/
function wp_supports_ai(): bool {
$is_enabled = defined( 'WP_AI_SUPPORT' ) ? WP_AI_SUPPORT : true;
/**
* Filters whether the current request should use AI.
*
* This allows plugins and 3rd-party code to disable AI features on a per-request basis, or to even override explicit
* preferences defined by the site owner.
*
* @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.
*/
return (bool) apply_filters( 'wp_supports_ai', $is_enabled );
}
Default connectors will only be registered if that function returns true.
It also has an effect on wp ai generate, as the prompt builder will return a WP_Error with code prompt_prevented and message AI features are not supported in this environment..
We should add some coverage for that in the existing tests.
wp ai is-supported is a new command that simply checks this function and returns an error code (0 or 1).
Activity