SearchWP

This Documentation is for SearchWP Version 3

Available since: 3.0

searchwp_acf_remove_field_references

View Parameters »

Note: Use of this hook will require a manual reindex

Advanced Custom Fields utilizes post meta (Custom Fields) to store internal data necessary for plugin functionality. This data is often useless when it comes to searching, so SearchWP allows you to tell it to disregard these field references if you’d like.

NOTE: There is potential for collision here based on how you have named your fields in ACF. SearchWP determines which field references to remove based on the registered fields you have in ACF. If one of your field names matches that of a Custom Field used by another plugin, you can inadvertently tell SearchWP to ignore a Custom Field that you do in fact want indexed. For example, if you’re using WooCommerce and Advanced Custom Fields, and you have an ACF field with the name of sku using this hook will cause WooCommerce SKUs to be removed because WooCommerce uses _sku to store SKUs.

See also: https://searchwp.com/docs/hooks/searchwp_acf_remove_field_reference/

<?php
// NOTE: See https://searchwp.com/docs/hooks/searchwp_acf_remove_field_references/
add_filter( 'searchwp_acf_remove_field_references', function( $remove, $context ) {
// TODO: Determine whether ACF field references should be removed.
return $remove; // true/false
}, 20, 2 );
view raw functions.php hosted with ❤ by GitHub

Parameters

Parameter Type Description
$remove Boolean

Whether to remove ACF field references

$context Array

$context['post_type'] The post type being indexed

[wpforms id="3080"]