WP-CLI is the command-line interface for WordPress. With WP-CLi you can update plugins, configure installations and much more, without using a browser.

FacetWP includes built-in support for using WP-CLI to do a full or partial re-index, or to purge FacetWP’s index table.

Installing WP-CLI

WP-CLI is a PHP package that you install on your web server.


FacetWP provides 2 CLI commands:

wp facetwp index [--ids=<ids>] [--facets=<facets>]


wp facetwp purge [--ids=<ids>] [--facets=<facets>]
  • ids (optional) — a comma-separated list of post IDs
  • facets (optional) — a comma-separated list of facet names


Re-index the entire site:

wp facetwp index

Re-index a single post:

wp facetwp index --ids=42

Re-index facets named “make” and “model”:

wp facetwp index --facets=make,model

Re-index a post type named “cars”:

wp facetwp index --ids=$(wp post list --post_type=cars --format=ids | tr " " ",")

Purge the index table:

wp facetwp purge

Purge values for a facet named “year”:

wp facetwp purge --facets=year

See also