Extract the archive in a folder named
wp-content/pluginsdirectory of your WordPress instance
- Enable the plugin from your admin Plugins page
Add 2 constants to your wp-config.php file:
Add 1 constant to determine the environment prefix for your indices:
What is already provided
We provided you with some code for the
Posts to get you started with building an indexing pipeline.
Please have a look inside the
3 files there:
- PostRecordsProvider: Defines the way to fetch records from WordPress and how to transform it into Algolia records.
- PostsIndexSettingsFactory: Defines the Algolia settings for the index (will be pushed on every new full re-index).
- PostChangeListener: Watches for changes on the articles, and pushes the updated article to Algolia.
The last file you need to be aware of is:
algolia.php: It bootstraps the plugin and registers your indices.
Index your data
The indexing needs to be done from the command line.
First make sure you have WP-CLI installed.
Then you can run the re-index command we provide:
$ wp algolia reIndex articles
articles is the name of your index. When you’ll have more indices, you can change that with another index name.
After the re-index process finished, you should have everything pushed to Algolia, and the settings should be set.
Adding more indices
To be able to add your other content types, you need to inspire from what’s existing:
Copy paste the Post classes from
inc/MyCompanyand adjust them
Register the new index in the
Once you have introduced new indices, you can re-index them by doing for example:
$ wp algolia reIndex my_custom_index_name
In case you altered just the settings an don’t want to operate a full re-index, you can run the following command:
$ wp algolia pushSettings my_custom_index_name