Having some issues since upgrading to 4.9. It looks like my wp_query based on a relationship within a flexible content field stopped working. Anyone find a fix?
function allow_wildcards( $where ) {
global $wpdb;
$where = str_replace(
"meta_key = 'portfolio_flex_options_%",
"meta_key LIKE 'portfolio_flex_options_%",
$wpdb->remove_placeholder_escape($where)
);
return $where;
}
add_filter('posts_where', 'allow_wildcards');
$listArgs = array(
'post_type' => 'listing',
'posts_per_page' => 4,
'meta_query' => array(
//'relation' => 'AND',
array(
'key' => 'portfolio_flex_options_%_brokers',
'compare' => '=',
'value' => $postID
),
),
);
I temporary solved the issues by changing % by AAA
function my_posts_where( $where ){
$where = str_replace("meta_key = 'courses_AAA_week_day'", "meta_key LIKE 'courses_%_week_day'", $where);
return $where;
}
add_filter('posts_where', 'my_posts_where');
/* my query args */
$args['meta_query']=array(array(
'key' => 'courses_AAA_week_day',
'value' => $day,
'compare' => '=',
'type' => 'NUMERIC'
));
/* ... */