Skip to main content
Cookbook SEO Yoast SEO

Find Posts Competing for the Same Focus Keyphrase in Yoast SEO with AI

Find the posts that share a Yoast focus keyphrase and move them onto distinct keyphrases, with your approval on every change.

Difficulty Intermediate
Time ~15 min

Prerequisites

A connected site running Yoast SEO 28.6 or newer (the free version works) on WordPress 6.9 or newer. Yoast only offers these abilities on a production site (WordPress environment type production, the default); a staging or local copy set to another environment type shows none.

The prompt
I use Yoast SEO on my WordPress site. Find published posts and pages that use the same focus keyphrase. Read every focus keyphrase with this read-only database query on Yoast's indexable table: SELECT object_id, object_sub_type, breadcrumb_title, primary_focus_keyword FROM {prefix}yoast_indexable WHERE object_type='post' AND post_status='publish' AND primary_focus_keyword IS NOT NULL. If it returns nothing, tell me Yoast has not indexed my posts yet and that Yoast SEO, Tools, SEO data optimization fixes it. Group the posts whose keyphrases match after ignoring case, plurals, and word order. Show me each group with the post titles, URLs, and SEO scores from the yoast-seo/get-post-seo-data ability. For each group, read the posts with the REST API and recommend which one should keep the keyphrase (the most complete one, or the one more of my posts link to) and a different, specific keyphrase for each of the others, based on what that post covers that the others do not. If two posts cover the same thing, say so and suggest merging them instead of a new keyphrase. Change nothing until I approve. Save only the keyphrases I approve, one post at a time, with WP-CLI: post meta update [post ID] _yoast_wpseo_focuskw '[new keyphrase]' --force. Read each one back with get-post-seo-data. Give me the list of changed posts and remind me to open each in the editor and click Update so Yoast recalculates its SEO score.
Already connected?

Skip pasting the full prompt. Drop this into your AI on a site that already has WPVibe:

Run the “Find Posts Competing for the Same Focus Keyphrase in Yoast SEO with AI” recipe from the WPVibe cookbook on my connected site.

Yoast warns you when you reuse a focus keyphrase, but only inside the post you are editing, and only if you notice. A few years of publishing later, three posts target “best running shoes” and none of them ranks as well as one would. Finding every overlap means opening every post.

The AI reads the focus keyphrase of every published post and page from Yoast’s own data, groups the ones that match or nearly match, and shows you each group with titles and SEO scores. For each group it suggests which post should keep the keyphrase and a distinct one for the others, based on what each post actually covers. It saves only the keyphrases you approve, into the same Yoast field the editor uses, and reads each one back.

Paste the prompt as it is. A new keyphrase does not rescore the post by itself: Yoast calculates the SEO score in the editor, so open each changed post and click Update to see its new score. When two posts really cover the same thing, a new keyphrase only hides the problem. Merging them is the fix, and the duplicate content recipe walks through it.

Outcome

Each focus keyphrase on your site belongs to one post, every change was approved by you, and you know which posts to merge.