ACF Fields Indexer
Make Advanced Custom Fields (ACF) searchable by the native WordPress search engine with zero performance cost. Indexes selected fields into post_content for O(1) speed.
by WordPress Engineer · github.com/dnalvesx/acf-fields-indexer
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/dnalvesx/acf-fields-indexer/archive/refs/heads/main.zipMake your Advanced Custom Fields searchable by the native WordPress search engine without performance penalties.
🚀 Overview
By default, WordPress Native Search (?s=query) only looks at the post_title and post_content columns. It completely ignores metadata stored in wp_postmeta, which means data stored in ACF (Advanced Custom Fields) is not searchable.
Existing solutions usually involve:
- Heavy SQL JOINs: Killing database performance.
- External Indexes: Creating bloat and dependency (vendor lock-in).
ACF Fields Indexer solves this by injecting selected ACF values directly into the post_content inside a hidden HTML block. This makes the content instantly searchable by WordPress, REST API, and WP GraphQL with O(1) performance.
✨ Features
- Zero Frontend Bloat: No CSS or JS files added to your site.
- High Performance: Uses native WordPress tables. No heavy JOIN queries.
- Vendor Agnostic: Works with any theme, page builder (Elementor, Divi, Bricks), or Headless setup.
- Selective Indexing: You choose exactly which Post Types and Fields to index.
- Batch Processing: Includes a built-in tool to index thousands of existing posts in the background.
- Clean Data: Automatically removes old index data when you update settings.
🛠 Installation
- Download the plugin folder
acf-fields-indexer. - Upload it to your WordPress directory:
/wp-content/plugins/. - Activate the plugin through the Plugins menu in WordPress.
⚙️ Configuration
Go to Settings > ACF Indexer.
1. Target Post Types
Define which content types should be monitored. Enter the slugs separated by commas.
- Example:
post, page, product, obra
2. ACF Fields to Index
Define which ACF field values should be searchable. Enter the Field Names (not labels) separated by commas.
- Example:
isbn, sku, author_bio, release_year
3. Save Changes
Click "1. Save Settings".
♻️ Indexing Existing Content (Backfill)
If you have existing content created before installing this plugin, you need to run the Batch Indexer.
- Go to Settings > ACF Indexer.
- Scroll down to the Maintenance section.
- Click "2. Start Batch Indexing".
- Wait for the process to finish. The page will reload automatically processing 50 posts at a time.
Note: Whenever you add or remove a field from the configuration, you should run the Batch Indexer to update all posts with the new rules.
🧠 How it Works (Under the Hood)
When a post is saved (or processed via batch), the plugin:
- Retrieves the values from the selected ACF fields.
- Sanitizes the data (strips HTML tags).
- Appends a hidden Gutenberg HTML block to the end of the
post_content.
Example of injected code:
<div class="afi-search-index" style="display:none" aria-hidden="true">
978-0-123-45678-9 Blue Hardcover 2024
</div>