[wp-trac] [WordPress Trac] #64924: Add a `has_ai_credentials()` function to WordPress core that plugins can use to check if AI credentials are available.

WordPress Trac noreply at wordpress.org
Fri May 1 08:26:26 UTC 2026


#64924: Add a `has_ai_credentials()` function to WordPress core that plugins can
use to check if AI credentials are available.
----------------------------------------------+----------------------------
 Reporter:  raftaar1191                       |       Owner:  (none)
     Type:  enhancement                       |      Status:  new
 Priority:  normal                            |   Milestone:  Awaiting
                                              |  Review
Component:  AI                                |     Version:  trunk
 Severity:  normal                            |  Resolution:
 Keywords:  connectors ai-client 2nd-opinion  |     Focuses:
                                              |  sustainability
----------------------------------------------+----------------------------

Comment (by darshitrajyaguru97):

 Adds `has_ai_credentials()` to core in `wp-includes/connectors.php`.

 - Implements credential detection via `wp_get_connectors()`
 - Supports API key-based authentication
 - Includes `wpai_has_ai_credentials` filter for extensibility
 - Adds defensive checks for connector structure
 - Includes unit tests for:
   - No connectors
   - Missing credentials
   - Valid credentials
   - Filter override

 This aligns with the Connectors API and avoids duplicating logic currently
 present in the AI plugin.

 **Note:** The filter passes the computed `$has_credentials` value rather
 than a hardcoded `false`, allowing partial detection logic to be preserved
 while still enabling overrides.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/64924#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list