Related Posts: Add WordPress Abilities API integration#47430
Related Posts: Add WordPress Abilities API integration#47430
Conversation
Register Related Posts as a discoverable ability via the WordPress Abilities API (WP 6.9+), exposing it through the REST API and MCP for AI agents.
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! Jetpack plugin: The Jetpack plugin has different release cadences depending on the platform:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
Code Coverage SummaryCoverage changed in 2 files.
1 file is newly checked for coverage.
|
Change `require` to `require_once` for related-posts.php in the abilities test file to prevent "Cannot declare class" fatal error when PHPUnit discovers both test files in the same directory.
Rename the ability from jetpack-related-posts/get-related to jetpack/get-related-posts for a cleaner namespace. Clean up test file: remove misleading tests that couldn't verify their claimed behavior, use instance properties, drop unnecessary tear_down/uniqid/wp_set_current_user, and verify registration via the real init path.
Fixes #
Proposed changes:
jetpack/get-related-postsability that returns related post data (title, URL, excerpt, date, author, context) for a given post IDJetpack_RelatedPosts::init_raw()to avoid DOM/asset side effectsOther information:
Jetpack product discussion
Does this pull request change what data or activity we track or use?
No.
Testing instructions:
GET /wp-json/wp-abilities/v1/abilities(look forjetpack/get-related-posts)post_id(expectmissing_post_iderror), use non-existent ID (expectpost_not_founderror)function_exists()checks)Changelog