While Algolia doesn’t offer an official WordPress integration, you can make your own. This guide walks you to the process of building your own Algolia WordPress integration using the PHP API client.
Adding Algolia to your WordPress website takes three main steps:
- Indexing your data
- Optimizing relevance
- Building the frontend search experience
There are two ways to index your data, either by creating a custom plugin or adding the feature to your active theme. The recommended way is to create a plugin to hold all the generic code, so you can reuse it for another blog or when switching themes.
In WordPress, most features live in the theme (such as custom post types or post meta), making it challenging to keep things truly separated. The best solution is to create a plugin to take care of the plumbing work and keep the content-related logic in the theme.
This guide assumes some basic WordPress development knowledge. Typically, you know what a custom post type and a post meta are, and how to use actions and filters. You also need some elementary PHP skills and knowing how to run commands from your terminal.
Regarding technical requirements, make sure you have: