Set SEO metadata
set_seo_metaPreview and apply SEO metadata for WordPress content: set title, meta description, focus keyword, canonical URL, and robots noindex/nofollow with a confirm step before writing.
Instructions
Set the SEO title, meta description, focus keyword, canonical URL and robots noindex/nofollow for one content item, written the way the active SEO plugin expects: its own REST route where one exists (Rank Math updateMeta, AIOSEO, SEOPress), otherwise its post meta keys via core REST (when registered) or the companion plugin's meta route. Always previews first: the initial call shows before → after and returns a confirm_token; re-run with the token to write. Refuses when no SEO plugin is active, because WordPress core would ignore the values.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Content ID to update. | |
| type | No | Content type of the id. Omit to search post, page and then other types. | |
| title | No | SEO title. Plugin template variables (%%title%% for Yoast, %title% for Rank Math) are passed through. Empty string clears the override. | |
| plugin | No | Force the target plugin when detection misses it. Writing a plugin's keys while that plugin is inactive has no visible effect. | |
| noindex | No | true asks search engines not to index this item; false explicitly allows indexing. | |
| site_id | No | Which configured WordPress site to act on. Optional — with a single site configured it is used automatically; with several, the default site is used unless you name one. Run list_sites for valid ids. | |
| nofollow | No | true asks search engines not to follow links on this item. | |
| canonical | No | Absolute canonical URL. Empty string clears the override so the plugin's default applies. | |
| description | No | Meta description; ~140–160 characters reads best in results. Empty string clears the override. | |
| confirm_token | No | Token from the preview call. Omit to preview; pass it back unchanged with identical arguments to apply. | |
| focus_keyword | No | Focus keyphrase used by the plugin's content analysis. Not supported by The SEO Framework. |