Make WordPress Core


Ignore:
Timestamp:
03/19/2026 01:55:45 PM (7 months ago)
Author:
SergeyBiryukov
Message:

AI: Introduce wp_supports_ai() function to control LLM-related features.

This includes a WP_AI_SUPPORT constant and a wp_supports_ai filter.

When false,

  • _wp_connectors_get_provider_settings() will return an empty array (short-circuiting the other functionality).
  • WP_AI_Client_Prompt_Builder() will short-circuit the construction with a WP_Error(). wp_ai_client_prompt() will still return an instance, to allow for fluidity to remain intact.

Priority: WP_AI_SUPPORT > add_filter( 'wp_supports_ai', ...) > (default: true)

Follow-up to [61943], [61749], [61943].

Props justlevine, westonruter, gziolo, flixos90, romainmrhenry, ahortin, chrismcelroyseo, SergeyBiryukov.
See #64706.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-connector-registry.php

    r62056 r62067  
    171171                }
    172172
     173                if ( 'ai_provider' === $args['type'] && ! wp_supports_ai() ) {
     174                        // No need for a `doing_it_wrong` as AI support is disabled intentionally.
     175                        return null;
     176                }
     177
    173178                $connector = array(
    174179                        'name'           => $args['name'],
Note: See TracChangeset for help on using the changeset viewer.