Connectors: Register Akismet Anti-Spam as a default connector#11399
Connectors: Register Akismet Anti-Spam as a default connector#11399jorgefilipecosta wants to merge 7 commits intoWordPress:trunkfrom
Conversation
Add Akismet as a non-AI default connector with `spam_filtering` type. Uses the existing `wordpress_api_key` option for the API key and checks the `WPCOM_API_KEY` constant. See #64957.
|
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 Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @1178653+wordpress-develop-pr-bot[bot]@users.noreply.github.com. Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases. Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
| _wp_connectors_register_default_ai_providers( $registry ); | ||
| } | ||
|
|
||
| // Non-AI default connectors. |
There was a problem hiding this comment.
Only this part is relevant the rest is Gutenberg ref update which is included for testing but will not be part of the commit.
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
Adjusts unit tests to account for the newly registered Akismet connector: - Add `akismet` to expected connector keys and update count. - Allow `spam_filtering` as a valid connector type. - Scope `connectors_ai_` setting name check to AI providers only. - Add `wordpress_api_key` to expected REST settings. See #64730.
Co-authored-by: Chris R <chris@bluefuton.com>
Co-authored-by: Chris R <chris@bluefuton.com>
Co-authored-by: Chris R <chris@bluefuton.com>
Trac Ticket MissingThis pull request is missing a link to a Trac ticket. For a contribution to be considered, there must be a corresponding ticket in Trac. To attach a pull request to a Trac ticket, please include the ticket's full URL in your pull request description. More information about contributing to WordPress on GitHub can be found in the Core Handbook. |
|
@bluefuton, can we change the copy to a more generic version, like:
|
| "PATCH" | ||
| ], | ||
| "args": { | ||
| "wordpress_api_key": { |
There was a problem hiding this comment.
@jorgefilipecosta, I was thinking about it. Akismet is using a custom setting name, which means they already control it and register themselves. In that case, I think it's fair to assume that WP core doesn't need to handle it. If it is needed for testing purposes, we can always mock it for individual tests.
Concluding, let's auto-register the setting name only when not set explicitly. AI is a bit awkward in that regard, so maybe we can add a special case there, too.
There was a problem hiding this comment.
Just checking, does the setting need to be registered before plugin installation for JS to function properly?
There was a problem hiding this comment.
I investigate it further, and it looks like the setting gets registered only if the plugin doesn't do it earlier. It seems like a sound approach. In that case, it's only the fallback in WP core.
Unfortunately, I can't think of a simple way to prevent such registration when Akismet isn't installed. Well, what I said earlier still holds. However, it might not be trivial to achieve such a goal.

Summary
Register Akismet Anti-Spam as a built-in non-AI connector with
spam_filteringtype.wordpress_api_keyWordPress option for API key storageWPCOM_API_KEYPHP constantTesting
Verify the akismet connector works as expected:
See also: WordPress/gutenberg#76828