WordPress’s standard keyword search does not search custom-field text by default. If you want a search box to match words inside selected fields, use a search plugin that indexes those fields or build a custom search integration. If you already know the field and value you want, use a WP_Query meta_query instead; that filters posts by metadata but does not add metadata to keyword search.
Choose between filtering and keyword search
The right approach depends on what a visitor is entering. A known value, such as a product type or event date, is a metadata-filtering problem. Words typed into a general search box that should match text in custom fields require those fields to be included in a search index.
| Need | Approach | What it does |
|---|---|---|
| Find posts whose field equals a value, exists, falls in a range, or meets another defined condition | WP_Query with meta_query |
Filters results using metadata conditions; it does not make all metadata part of the standard keyword search. |
| Let ordinary search terms match text in selected custom fields | Configure a search plugin, such as Relevanssi, to index those fields | Adds chosen field content to the plugin’s searchable index. Choose fields deliberately to avoid irrelevant metadata. |
| Search unusual storage locations or apply specialized ranking and matching rules | Custom integration or plugin hooks | Can address needs not covered by a standard post-field index, but requires development and ongoing maintenance. |
WordPress documents s as the keyword-search argument for WP_Query, while meta_key, meta_value, and meta_query are metadata query arguments. WP_Meta_Query builds SQL joins and conditions to filter records; it is not a relevance-ranked full-text index.
Filter posts by a known custom-field value
Use meta_query when the field and condition are known in advance—for example, a form that lets visitors select a property type. Set the metadata key to the field’s stored key, choose an appropriate comparison, and specify a data type when the comparison depends on it.
#1 Best Overall
$query = new WP_Query( array(
'post_type' => 'post',
'meta_query' => array(
array(
'key' => 'property_type',
'value' => 'apartment',
'compare' => '=',
),
),
) );
Replace property_type with the actual metadata key and apartment with the submitted or desired value. Add the relevant post type and other query arguments for your site. For numeric or date ranges, select a comparison and type that match how the value is stored; a string comparison may not produce the intended numeric or date ordering.
Comparisons such as equality, EXISTS, or LIKE remain filters against metadata. In particular, a LIKE condition for a known field does not turn the normal WordPress search box into a general custom-field keyword search. Check the field key and stored representation when results are missing or unexpectedly broad.
Make selected custom fields match free-text searches
Index fields with a search plugin
Relevanssi documents indexing custom fields, including data from Advanced Custom Fields (ACF). Its custom-field settings offer choices to index all fields, visible fields, or specifically named fields. For most sites, selecting the fields that actually contain useful search text is the safer starting point: themes and plugins may add metadata that is irrelevant to visitors.
- Install and configure the search plugin you choose, following its current setup instructions.
- Open its custom-field indexing settings and select the specific field names that should be searchable, rather than indexing every field by default.
- Update or rebuild the plugin’s index as required after changing the indexed-field selection or changing relevant content.
- Run searches using words present only in the chosen fields, then check expected matches, non-matches, and relevance on representative records.
The exact settings location and index-refresh controls depend on the plugin version and configuration. Confirm those details in the plugin’s current documentation and in your WordPress admin rather than relying on a fixed menu path.
Rank #3
Check how the field data is stored
ACF field values saved on posts can be included when a compatible search plugin indexes those fields. Data stored in site options rather than on individual posts may not be included in the plugin’s ordinary post index and can require additional integration. Repeater-style or serialized values also warrant testing: matching behavior depends on the stored format and the plugin’s support for it.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.When a custom integration makes sense
Consider custom code or plugin hooks when the content lives outside ordinary post metadata, when search needs unusual weighting or matching rules, or when the chosen plugin cannot represent the desired behavior. First identify every storage location the results must cover. Then define how content enters the index, how updates and deletions keep it current, and how results should be ranked. This approach gives greater control but also makes compatibility, testing, and ongoing maintenance your responsibility.
Quick Recap
Best Value
Rank #4
Test the search behavior before relying on it
- Include records with matching text in the selected field and records where the term appears only in the title or body.
- Test empty fields, punctuation, capitalization, and representative field values.
- Check the actual saved value for ACF, repeater-style, or other complex fields instead of assuming the field label describes its stored format.
- After changing indexed fields or content, confirm that the plugin’s index has been refreshed as required.
- Verify that the results reflect the intended distinction: metadata conditions filter known values, while an indexed field lets keyword searches match its text.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

