Skip to content

Add wp ai is-supported #12

Closed
Closed

Description

@swissspidy

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

  1. added
    command:ai
    command:ai-status
    enhancement
    scope:testing
    on Mar 27, 2026
  2. linked a pull request that will close this issueAdd `wp ai is-supported` command #13on Mar 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

command:aicommand:ai-statusenhancementscope:testing

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions