Skip to content

Switch to the new wp_get_connectors function#301

Merged
jeffpaul merged 1 commit intoWordPress:developfrom
dkotter:update/connectors-function
Mar 12, 2026
Merged

Switch to the new wp_get_connectors function#301
jeffpaul merged 1 commit intoWordPress:developfrom
dkotter:update/connectors-function

Conversation

@dkotter
Copy link
Copy Markdown
Collaborator

@dkotter dkotter commented Mar 11, 2026

What?

Switches to the new wp_get_connectors function and away from private functions

Why?

While adding support for the new Connectors experience coming in 7.0, we needed a new approach to get all stored AI connectors, so we can alert users when they don't have any connectors in place. I copied the approach that was in WordPress at the time which required the use of some private functions (prefixed with _).

There's now a new wp_get_connectors function we can use instead, as well as it looks like one of the private functions we were using will be removed, so nice to move away from that.

How?

  • Switches from using _wp_connectors_get_connector_settings to wp_get_connectors
  • Switches from using _wp_connectors_get_real_api_key to just doing a direct get_option call, as we don't care if the API key is valid in this check, just if it exists

Use of AI Tools

None

Testing Instructions

  1. Install the latest trunk version of WordPress (as the wp_get_connectors function only exists there at the time of this writing)
  2. Go to Settings > Connectors and ensure you have at least on Connector installed and an API key in place
  3. Go to Settings > AI Experiments and ensure you don't see any error message at the top of the page about a missing AI connector
  4. Switch to WP 7.0-beta4 and do the same steps
  5. You should see an error message now at Settings > AI Experiments but should not get any fatal errors as well as all functionality should still work
Open WordPress Playground Preview

@dkotter dkotter added this to the 0.5.0 milestone Mar 11, 2026
@dkotter dkotter self-assigned this Mar 11, 2026
@dkotter dkotter requested a review from jeffpaul March 11, 2026 21:13
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 11, 2026

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: dkotter <dkotter@git.wordpress.org>
Co-authored-by: jeffpaul <jeffpaul@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@dkotter
Copy link
Copy Markdown
Collaborator Author

dkotter commented Mar 11, 2026

@jeffpaul This doesn't necessarily have to go in 0.5.0 but would probably be nice, as I believe the issue this PR addresses will be present in the next beta (at the very least, the new wp_get_connectors function has been merged to trunk so I'm assuming that will get pulled into beta5)

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 11, 2026

Codecov Report

❌ Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 58.03%. Comparing base (f8de37d) to head (ac3c4d9).
⚠️ Report is 2 commits behind head on develop.

Files with missing lines Patch % Lines
includes/helpers.php 0.00% 3 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             develop     #301      +/-   ##
=============================================
+ Coverage      58.01%   58.03%   +0.01%     
  Complexity       576      576              
=============================================
  Files             37       37              
  Lines           2956     2955       -1     
=============================================
  Hits            1715     1715              
+ Misses          1241     1240       -1     
Flag Coverage Δ
unit 58.03% <0.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Member

@jeffpaul jeffpaul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested with 7.0 nightly and works fine there, I say merge and pull into the 0.5.0 release

@jeffpaul
Copy link
Copy Markdown
Member

@dkotter any concern on the plugin check error?

@dkotter
Copy link
Copy Markdown
Collaborator Author

dkotter commented Mar 11, 2026

@dkotter any concern on the plugin check error?

No, unfortunately that's been failing for a while due to an upstream issue with Plugin Check. Looks like it's been fixed but a new release hasn't gone out

@jeffpaul jeffpaul merged commit 0fd9cbf into WordPress:develop Mar 12, 2026
16 of 18 checks passed
@github-project-automation github-project-automation bot moved this from Needs review to Done in WordPress AI Planning & Roadmap Mar 12, 2026
@jeffpaul jeffpaul mentioned this pull request Mar 12, 2026
19 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

2 participants