Skip to content
Richard Aber edited this page Nov 27, 2020 · 7 revisions

WP-CLI Algolia commands.

Introduction

WP-CLI is an extensible third party Command Line tool for WordPress.

This plugin ships with WP-CLI commands.

Installation

To setup WP-CLI, please read its official documentation.


If you are using WordPress in a multisite configuration (network enabled), you need to use the --url argument to specify which website you want to execute the command on. If you get the following message: The configuration for this website does not allow to contact the Algolia API., it means you are trying to execute a command on a website that is not configured properly to reach the Algolia API (missing the API keys for example).*


Command: algolia reindex [] [--clear] [--all]

The following command will re-index all items belonging to a given index.

If the --all parameter is passed, all enabled indices will be re-indexed.

If the --clear parameter is passed, all existing records will be cleared prior to pushing new records. Also works in combination with the --all parameter.

# Reindex content for the `posts_post` index...
wp algolia reindex posts_post
# Reindex content for all enabled indices...
wp algolia reindex --all
# Reindex content for all enabled indices, clear existing records first...
wp algolia reindex --clear --all