Aha! The conflict is from a set of functions in my child theme. The functions are for automatically creating bi-directional ‘relationships’ for ACF and to merge values for searching compatibility.
/* bidirectional relationships ---------------------------------------------------------- */
function bidirectional_acf_update_value($value, $post_id, $field)
{
$field_name = $field['name'];
$field_key = $field['key'];
$global_name = 'is_updating_'.$field_name;
if (!empty($GLOBALS[$global_name])) return $value;
$GLOBALS[$global_name] = 1;
if (is_array($value))
{
foreach($value as $post_id2)
{
$value2 = get_field($field_name, $post_id2, false);
if (empty($value2))
{
$value2 = array();
}
if (in_array($post_id, $value2)) continue;
$value2[] = $post_id;
update_field($field_key, $value2, $post_id2);
}
}
$old_value = get_field($field_name, $post_id, false);
if (is_array($old_value))
{
foreach($old_value as $post_id2)
{
if (is_array($value) && in_array($post_id2, $value)) continue;
$value2 = get_field($field_name, $post_id2, false);
if (empty($value2)) continue;
$pos = array_search($post_id, $value2);
unset($value2[$pos]);
update_field($field_key, $value2, $post_id2);
}
}
$GLOBALS[$global_name] = 0;
return $value;
}
add_filter('acf/update_value/name=related_to', 'bidirectional_acf_update_value', 10, 3);
/* add post types to search ---------------------------------------------------------- */
function rc_add_cpts_to_search($query) {
// Check to verify it's search page
if (is_search()) {
// Get post types
$post_types = get_post_types(array('public' => true, 'exclude_from_search' => false), 'objects');
$searchable_types = array();
// Add available post types
if ($post_types) {
foreach($post_types as $type) {
$searchable_types[] = $type - > name;
}
}
$query - > set('post_type', $searchable_types);
}
return $query;
}
add_action('pre_get_posts', 'rc_add_cpts_to_search');
/* Combine fields for search --------------------------------------------------- */
function cf_search_join($join) {
global $wpdb;
if (is_search()) {
$join. = ' LEFT JOIN '.$wpdb - > postmeta.
' ON '.$wpdb - > posts.
'.ID = '.$wpdb - > postmeta.
'.post_id ';
}
return $join;
}
add_filter('posts_join', 'cf_search_join');
function cf_search_where($where) {
global $pagenow, $wpdb;
if (is_search()) {
$where = preg_replace(
"/\(\s*".$wpdb - > posts.
".post_title\s+LIKE\s*(\'[^\']+\')\s*\)/",
"(".$wpdb - > posts.
".post_title LIKE $1) OR (".$wpdb - > postmeta.
".meta_value LIKE $1)", $where);
}
return $where;
}
add_filter('posts_where', 'cf_search_where');
function cf_search_distinct($where) {
global $wpdb;
if (is_search()) {
return "DISTINCT";
}
return $where;
}
add_filter('posts_distinct', 'cf_search_distinct');