We have added a WP CLI command to Yoast SEO 14.0. In Yoast SEO 14.0 we created new tables in which we combine all the metadata for indexable objects on a site. Please see Omar’s post for the reasoning behind this. Regardless of whether you’re using Yoast SEO in the conventional way or through the new headless functionality, this works the best and the fastest if your site’s meta data is fully indexed. You can make sure of that by running our WP CLI command!
If you don’t know what WP CLI is, you’re missing out! It’s a command line interface for WordPress that makes loads of tasks easier. Read all about it on wp-cli.org.
If you’re using our REST API or our surfaces, running this CLI command on your site before going into production with those is very important.
Syntax
The syntax for this WP CLI command is very simple:
If one of these doesn’t show that is because all of the items in there were already indexed. Authors are indexed as part of the posts indexation process. If you want to test this index command multiple times, please use the Yoast Test Helper. If you hit the “Reset Indexables tables & migrations” button in that plugin, it’ll delete the Indexables tables. After that you can run the process again.
Potential Yoast SEO WP CLI errors
You might get this error:
Error: 'index' is not a registered subcommand of 'yoast'. See 'wp help yoast' for available subcommands.
This means you’re not on the correct version of Yoast SEO. Please note that you need to be on Yoast SEO 14.0 or higher for the Yoast SEO WP CLI command index to work.
Joost is an internet entrepreneur and the founder of Yoast. He has a long history in WordPress and digital marketing. On our blog, he has written a lot about SEO in general, technical SEO and important topics related to SEO.
October 27 - 28, 2025
Team Yoast is Attending, Speaking at State of Search 2025! Click through to see who will be there, what we will do, and more!
See where you can find us next »
3 November 2025
Learn how to start your SEO journey the right way with our free webinar. Perfect for beginners seeking to improve website performance 🚀 .
All Yoast SEO Webinars
Discussion (21)
Torsten's BüchereckeMay. 03, 2020
Hi,
This is not working for me and does not make much sense.
The user which executes the shell command is not the same than the database user. The user which is running the webspace (e.g. Apache / Nginx) is not even able to logon (which results in “This account is currently not available.”).
With another user which is not running the webpace Folders I’m getting the error:
Undefined index: HTTP_X_FORWARDED_PROTO in phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1197) : eval()’d code on line 74
Due to the fact the GUI version does also not work 72423 / 3000 (counting up forever) it is not usable at the moment.
But now the message vanished and I found a text:
Speeding up your site
Great, your site has been optimized!
Is this a positive result?
Best regards
Edwin ToonenMay. 04, 2020
Hi Torsten. I’m sorry for the inconvenience. You say the process finally finished? That’s good. Have you run into any issues or is everything now running properly?
Gilad GoralyMay. 03, 2020
My WordPress admin interface is not working after running it. How do I revert it?
Valeriu TihaiMay. 02, 2020
Hi, I think the update script does the thinks wrong, for 250+ posts I have wp_yoast_indexable table with 2 000 000+ records and 850+MB
In the new update, Meta Title has been added to the plugin, which means that two meta tag tags have been used in my source.
One is the template tag itself, the other by the plugin
My site address is available, you can check
Sovit RanjitkarMay. 01, 2020
Hi there,
I am using free version of this plugin and before updating to the latest version there is something info recommendation to index the process manually. Can you please clarify those changes in the latest version of your plugin.
Before updating to the new version let me know you that my site is a WooCommerce store site and there is no any post into my site only there is a products where I sell digital products. What should I do?
Hope you will reply ASAP.
Thank you!
Regards,
Sovit Ranjitkar
Full Stack Developer
Edwin ToonenMay. 04, 2020
Hi Sovit. You don’t need to run the indexing process. You can leave it and it will fill the index itself once all pages are visited by users.
AboelabbasMay. 01, 2020
Thank you. I think it will be better if you clearly mention that the indexation limit per pass can be increased through filters. In our case, we ran the indexing process more than once and it took too long each because it involved more than 100000 records, at first we thought it is normal to be that slow but it was due to the limit per pass.
Willemien HallebeekMay. 01, 2020
Hi! Thanks for your addition! Filters can indeed affect how long indexation takes, we’ll make sure to include that in the post!
ramMay. 01, 2020
Do I need to make any changes to the current settings? I am not much of a tech guy.
KhanApr. 30, 2020
this site is 18k posts, I have 4 others with over 100k
Taking too long maybe I am doing something wrong. or is it because of MariaDB?
KhanApr. 30, 2020
Ive done this once on 14.0.2 now again I am being asked to perform indexing. the site is huge.
The comment says I don’t have to do it with every update but I am being prompted. Should I ignore it? or do it again for 14.0,4?
Willemien HallebeekMay. 01, 2020
Hi Khan! You’re right, you won’t have to do this with each next update. And for now, you could also choose to let it index automatically over time as your pages get visited. Then, you can run the index in a couple of weeks’ time to cover the pages/objects that didn’t get any traffic.
DarrinApr. 30, 2020
Hi there, thanks for providing this information. Please note that with v14.04 installed, after failing with v14.02, we’re still seeing failing in the index processing, even with Yoast SEO WP CLI. We’ve also utilized the “Reset Indexables tables & migrations” function of the Yoast Test Helper and retried. Same end result. Here’s a log:
…that gets repeated over and over again until ctrl-c cancels the process. Appreciate any help or guidance.
Sincerely,
Darrin @ Rambillo
Willemien HallebeekMay. 01, 2020
Hi! I’m sorry to hear you’re having problems with this. We’re aware of this issue, it appears a post has set itself as ‘parent’, creating an infinite loop. Locating this post and changing that should fix the issue. Hope that helps!
Luke CavanaghApr. 29, 2020
Is there a way to speed up the command to run or run the migration in batches?
Joost de ValkApr. 30, 2020
Hey Luke,
I don’t know what kind of site you’re needing this for but we’ve seen sites of 100k posts do this in just over 5 minutes.
Robin ScottMay. 02, 2020
Hi, this is mentioned in a comment above, however, I’m not seeing the actual command to adjust posts per pass in the blog post, nor a link to docs. Your –help command doesn’t shed any light on how to increase this either, so 100K posts appears to be 3 hours – it doesn’t need to be, from what you are saying, so some documentation would be ideal :)
KhanApr. 30, 2020
Nope, 18k posts site taking more than 3 hours
HaviApr. 29, 2020
Hi guys, that sounds great! But what should we do if we are not developers and have less than 10,000 posts? (Hoping the response will be, you are fine and do not need to do anything)
Thank you in advance!
Havi
Joost de ValkApr. 30, 2020
Hi Havi,
two options: either you hit the reindex button in your dashboard, or, your preferred option, you do nothing, in that second case, the database will “lazy load”: it’ll slowly fill as posts are visited. :)
Hi,
This is not working for me and does not make much sense.
The user which executes the shell command is not the same than the database user. The user which is running the webspace (e.g. Apache / Nginx) is not even able to logon (which results in “This account is currently not available.”).
With another user which is not running the webpace Folders I’m getting the error:
Undefined index: HTTP_X_FORWARDED_PROTO in phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1197) : eval()’d code on line 74
Due to the fact the GUI version does also not work 72423 / 3000 (counting up forever) it is not usable at the moment.
But now the message vanished and I found a text:
Speeding up your site
Great, your site has been optimized!
Is this a positive result?
Best regards
Hi Torsten. I’m sorry for the inconvenience. You say the process finally finished? That’s good. Have you run into any issues or is everything now running properly?
My WordPress admin interface is not working after running it. How do I revert it?
Hi, I think the update script does the thinks wrong, for 250+ posts I have wp_yoast_indexable table with 2 000 000+ records and 850+MB
Proof of infinite loop https://www.dropbox.com/s/p0gu1w6n57lf38e/Screenshot%202020-05-02%2015.35.54.png?dl=0
Yoast Free Version 14.0.4
In the new update, Meta Title has been added to the plugin, which means that two meta tag tags have been used in my source.
One is the template tag itself, the other by the plugin
My site address is available, you can check
Hi there,
I am using free version of this plugin and before updating to the latest version there is something info recommendation to index the process manually. Can you please clarify those changes in the latest version of your plugin.
Before updating to the new version let me know you that my site is a WooCommerce store site and there is no any post into my site only there is a products where I sell digital products. What should I do?
Hope you will reply ASAP.
Thank you!
Regards,
Sovit Ranjitkar
Full Stack Developer
Hi Sovit. You don’t need to run the indexing process. You can leave it and it will fill the index itself once all pages are visited by users.
Thank you. I think it will be better if you clearly mention that the indexation limit per pass can be increased through filters. In our case, we ran the indexing process more than once and it took too long each because it involved more than 100000 records, at first we thought it is normal to be that slow but it was due to the limit per pass.
Hi! Thanks for your addition! Filters can indeed affect how long indexation takes, we’ll make sure to include that in the post!
Do I need to make any changes to the current settings? I am not much of a tech guy.
this site is 18k posts, I have 4 others with over 100k
Taking too long maybe I am doing something wrong. or is it because of MariaDB?
Ive done this once on 14.0.2 now again I am being asked to perform indexing. the site is huge.
The comment says I don’t have to do it with every update but I am being prompted. Should I ignore it? or do it again for 14.0,4?
Hi Khan! You’re right, you won’t have to do this with each next update. And for now, you could also choose to let it index automatically over time as your pages get visited. Then, you can run the index in a couple of weeks’ time to cover the pages/objects that didn’t get any traffic.
Hi there, thanks for providing this information. Please note that with v14.04 installed, after failing with v14.02, we’re still seeing failing in the index processing, even with Yoast SEO WP CLI. We’ve also utilized the “Reset Indexables tables & migrations” function of the Yoast Test Helper and retried. Same end result. Here’s a log:
wpe-user@xxx.ssh.wpengine.net:~$ wp yoast index
Indexing posts 9 % [====> ] 3:48 / 34:26
WordPress database error Duplicate entry ‘8676-8676’ for key ‘PRIMARY’ for query INSERT INTO `wp_yoast_indexable_hierarchy` (`indexable_id`, `ancestor_id`, `depth`, `blog_id`) VALUES (‘8676’, ‘8676’, ‘2’, ‘1’) made by include(‘phar:///usr/local/bin/wp/php/boot-phar.php’), include(‘phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/wp-cli.php’), WP_CLI\bootstrap, WP_CLI\Bootstrap\LaunchRunner->process, WP_CLI\Runner->start, WP_CLI\Runner->run_command_and_exit, WP_CLI\Runner->run_command, WP_CLI\Dispatcher\Subcommand->invoke, call_user_func, WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher\{closure}, call_user_func, Yoast\WP\SEO\Commands\Index_Command->index, Yoast\WP\SEO\Commands\Index_Command->run_indexation_actions, Yoast\WP\SEO\Commands\Index_Command->run_indexation_action, Yoast\WP\SEO\Actions\Indexation\Indexable_Post_Indexation_Action->index, Yoast\WP\SEO\Builders\Indexable_Builder->build_for_id_and_type, Yoast\WP\SEO\Builders\Indexable_Hierarchy_Builder->build, Yoast\WP\SEO\Builders\Indexable_Hierarchy_Builder->add_ancestors_for_post, Yoast\WP\SEO\Builders\Indexable_Hierarchy_Builder->add_ancestors_for_post, Yoast\WP\SEO\Repositories\Indexable_Hierarchy_Repository->add_ancestor, Yoast\WP\Lib\Model->save, Yoast\WP\Lib\ORM->save, Yoast\WP\Lib\ORM::_execute
…that gets repeated over and over again until ctrl-c cancels the process. Appreciate any help or guidance.
Sincerely,
Darrin @ Rambillo
Hi! I’m sorry to hear you’re having problems with this. We’re aware of this issue, it appears a post has set itself as ‘parent’, creating an infinite loop. Locating this post and changing that should fix the issue. Hope that helps!
Is there a way to speed up the command to run or run the migration in batches?
Hey Luke,
I don’t know what kind of site you’re needing this for but we’ve seen sites of 100k posts do this in just over 5 minutes.
Hi, this is mentioned in a comment above, however, I’m not seeing the actual command to adjust posts per pass in the blog post, nor a link to docs. Your –help command doesn’t shed any light on how to increase this either, so 100K posts appears to be 3 hours – it doesn’t need to be, from what you are saying, so some documentation would be ideal :)
Nope, 18k posts site taking more than 3 hours
Hi guys, that sounds great! But what should we do if we are not developers and have less than 10,000 posts? (Hoping the response will be, you are fine and do not need to do anything)
Thank you in advance!
Havi
Hi Havi,
two options: either you hit the reindex button in your dashboard, or, your preferred option, you do nothing, in that second case, the database will “lazy load”: it’ll slowly fill as posts are visited. :)