2

You can't easily query inside arrays inside a meta value. This is because there's no such thing as an array value in MySQL. Instead the value is stored as a serialized string. So an array like this: array( 0 => 29, 1 => 28, ); Is stored in the database as this string: a:2:{i:0;i:29;i:1;i:28;} So the only way to find values inside it is to ...


1

Have you tried it with add_action instead of add_filter ? add_action('pre_get_posts', 'search_custom_fields'); Is public set to true for your post_type? And for use on in admin, try: if ( is_admin() && $query->is_main_query() ) { if ( $query->is_search ) { //etc.


1

Current Query $args = array( 'post_type' => 'brands', 'meta_query' => array( array( 'key' => 'br_type', 'value' => 'Aviation' ), array( 'key' => 'br_category' ), array( 'key' => 'br_name' ) ), 'posts_per_page' => -1, 'orderby' => [ '...


1

First of all, just to clarify, in a normal situation without the specific order requirements, and assuming you are doing this on pre_get_posts hook, you would just do as follows: add_action('pre_get_posts', function ($query) { // only perform for a given query // do your checks and return early if (! $query->is_main_query() || ! $query->...


Only top voted, non community-wiki answers of a minimum length are eligible