filter wp_query result with custom field values
If main_category is a category (custom taxonomy), then you’re querying it wrong. This should go like this: $electronics = array( ‘numberposts’ => -1, ‘post_type’ => ‘article’, ‘main_category’ => ‘electronics’ ); $query_electronics = new WP_Query( $electronics ); If that’s a custom field, use meta_query: $electronics = array( ‘numberposts’ => -1, ‘post_type’ => ‘article’, ‘meta_query’ => array( … Read more