Introduce two new abilities for getting and setting SEO data for given posts#23369
Draft
leonidasmi wants to merge 8 commits into
Draft
Introduce two new abilities for getting and setting SEO data for given posts#23369leonidasmi wants to merge 8 commits into
leonidasmi wants to merge 8 commits into
Conversation
Coverage Report for CI Build 0Warning Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes. Coverage decreased (-0.2%) to 53.547%Details
Uncovered Changes
Coverage Regressions413 previously-covered lines in 19 files lost coverage.
Coverage Stats💛 - Coveralls |
57d78fa to
824cc9a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
Summary
This PR can be summarized in the following changelog entry:
Relevant technical choices:
Title-based post lookup:
post_id,permalink, ortitle. The title value is a comma-separated list; each value is matched as a whole contiguous substring of the post's breadcrumb title, and a post is returned if it matches any value (OR/union). Example —hiking boots, trailcompiles to:Test instructions
Test instructions for the acceptance test before the PR gets merged
This PR can be acceptance tested by following these steps:
Declaration of the abilities
The GET SEO data ability
http://example.com/wp-json/wp-abilities/v1/abilitiesendpoint and confirm that you see theyoast-seo/get-post-seo-dataability we added and that it looks like this:The SET SEO data ability
http://example.com/wp-json/wp-abilities/v1/abilitiesendpoint and confirm that you see theyoast-seo/update-post-seo-dataability we added and that it looks like this:Usage of the new abilities
Using the REST API
getting SEO dataability:/wp-json/wp-abilities/v1/abilities/yoast-seo/get-post-seo-data/run?input[id]=<POST_ID><POST_ID>is the post ID/wp-json/wp-abilities/v1/abilities/yoast-seo/get-post-seo-data/run?input[permalink]=https://basic.wordpress.test/uncategorized/<POST_URL><POST_URL>is the post's URL<POST_TITLE_KEYWORDS>is keywords that exist in the post's title, separated by commas (we're gonna test this more extensively below).10 ways to backpack across northern Europe, you can use10 ways, backpack, northern Europeor any combination of that, to find your post_renderedattributes are the ones that are output in the frontend, with default settings and replacement variables expandedyoast_seo_post_not_founderrorrest_ability_cannot_executeerrorsetting SEO dataability:/wp-json/wp-abilities/v1/abilities/yoast-seo/update-post-seo-data/run{"input":{"post_id":<POST_ID>,"seo_title":"new SEO title"}}{"input":{"permalink":<POST_PERMALINK>,"seo_title":"new SEO title"}}{"permalink":<POST_PERMALINK>,"schema_page_type":"FooPage"}}. Confirm that you get an error.yoast_seo_post_not_founderrorrest_ability_cannot_executeerrorUsing an AI agent
* Follow [the documentation on how to test WP Abilities](https://yoast.atlassian.net/wiki/spaces/PLUGIN/pages/4975198209/Set+up+an+MCP+server+to+test+WP+Abilities) *Test the post lookup via titles
Using REST API
//wp-json/wp-abilities/v1/abilities/yoast-seo/get-post-seo-data/run?input[title]=<KEYWORDS>, each time with a different title as :input[title]=hiking bootsshould yield the 2 first posts ("Hiking Boots Review" and "Best Hiking Boots 2026")input[title]=hiking boots, trailshould yield all posts ("Hiking Boots Review" and "Best Hiking Boots 2026" and "Trail Running Guide")input[title]=boots hikingshould yield no posts ([])Hiking Bootsin their title to test the pagination//wp-json/wp-abilities/v1/abilities/yoast-seo/get-post-seo-data/run?input[title]=<KEYWORDS>&input[page]=<NUMBER_OF_PAGINATION>, each time with a different title as :input[title]=hiking bootsandinput[page]=1should yield the 10 most recently modified postsinput[title]=hiking bootsandinput[page]=2should yield the next 10 most recently modified posts (if you followed the above instructions closely, this will be a single post with the "Hiking Boots Review" titleUsing AI Agent
Relevant test scenarios
Test instructions for QA when the code is in the RC
Impact check
This PR affects the following parts of the plugin, which may require extra testing:
Other environments
[shopify-seo], added test instructions for Shopify and attached theShopifylabel to this PR.[yoast-doc-extension], added test instructions for Yoast SEO for Google Docs and attached theGoogle Docs Add-onlabel to this PR.Documentation
Quality assurance
grunt build:imagesand committed the results, if my PR introduces or edits images or SVGs.Innovation
innovationlabel.Fixes #