wp_update_seo_meta: update supported SEO fields
Writes the SEO title and description on a post, for Yoast SEO or Rank Math.
Arguments
| Argument | Required | Meaning |
|---|---|---|
post_id |
Yes | The post or page |
yoast_title |
No | Yoast SEO title |
yoast_description |
No | Yoast meta description |
rank_math_title |
No | Rank Math SEO title |
rank_math_description |
No | Rank Math description |
dry_run |
No | Report without writing |
Only the arguments you pass are written.
Permissions
Allow content writes open — the content gate, not the option gate — and edit_post on that post.
Write to the plugin you actually use
The tool does not detect which SEO plugin is installed. It writes whichever keys you name, and writing Yoast fields on a Rank Math site stores values nothing will ever read.
The result is silent: the write succeeds, the response looks right, and the front end is unchanged.
Establish which plugin is in use first, by reading the post and seeing which block has values:
Read the SEO meta for post 412 and tell me which plugin has values. Then set the description for that plugin only.
Doing this once at the start of a session is enough; the answer applies to the whole site.
Writing both is not a safe default
It is tempting to write all four fields so that whichever plugin is active picks something up. Avoid it:
- it leaves stale values behind if the site ever migrates between plugins, and the migration then picks up years-old descriptions;
- it doubles the meta rows for no benefit;
- it hides the fact that you did not know which plugin was in use.
Find out, then write two fields.
Values are sanitised as plain text
All four are stored as sanitised text, so HTML will not survive. That is correct for these fields — a meta description is plain text by definition.
What it returns
The full SEO meta for the post, in the same shape wp_get_seo_meta returns. So the response doubles as a read-back, showing both blocks.
Check that the block you intended now has values and the other is still empty.
The dry run
Returns the post ID and the subset of arguments it recognised. That is genuinely useful here: if you passed an argument name slightly wrong, it will be missing from changes and you will see it before writing.
An override replaces a template
Both plugins generate a title and description from site-wide templates when a post has none. Writing here creates a per-post override.
That is usually the intent, but it means:
- a template that was producing a good description is no longer used for that post;
- the override does not update when the post's title changes, unlike a template;
- there is no revision history, so the previous override is gone.
Read before writing, as with any meta.
Length matters
Search engines truncate. Aim for a description that reads completely at roughly 150–160 characters, and a title that does not run past about 60.
The tool does not enforce or warn about either. If an assistant generated the text, ask for it at length and check it — Shorten text is the right tool for fitting a description to a limit.
Doing a batch
An SEO pass across many posts is a realistic job. Each post is one write, so the write rate limit of 20 per minute paces it.
Pilot first:
Read the current SEO meta for the first three posts, write descriptions for those three, show me the results, then stop.
Then check a couple of the pages' rendered source, not just the tool response. That is the only way to confirm the plugin is actually using what you wrote.
Common problems
| Symptom | Cause |
|---|---|
| The write is refused | Content write gate closed |
pom_ai_mcp_forbidden |
No edit_post on that post |
| The front end is unchanged | Fields written for the wrong plugin |
| An argument was ignored | Its name did not match; check the dry run's changes |
| The description is truncated in search results | Too long; search engines truncate |
| The previous value is gone | Meta has no revision history |
| Nothing visible after a correct write | Cache not purged, or search engines have not re-crawled |
Related
wp_get_seo_meta— read first to identify the pluginwp_update_post_metafor other meta- Review generated copy before publishing