Yoast SEO 14.0: WP CLI index command

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:

wp yoast index

The output will look something like this:

Indexing posts  100% [==============================] 0:00 / 0:00
Indexing terms  100% [==============================] 0:00 / 0:00
Indexing post type archives  100% [=================] 0:00 / 0:00
Indexing general objects  100% [====================] 0:00 / 0:00

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.

Questions? Let us know in the comments!

Coming up next!


21 Responses to Yoast SEO 14.0: WP CLI index command