Using new meta_query with custom post types
-
I’m having trouble using the new meta_query argument with a custom post type (not sure if that even has anything to do with it). Basically I’m trying to use a custom field value to sort through my custom post type.
function my_function($branch){ $args = array( 'posts_per_page' => 10, 'post_type' => 'officer_profile', 'meta_query' => array( 'key' => 'asg_branch_gvt', 'value' => $branch ) ); $officers = new WP_Query($args); }
But when I use the older method and remove the
meta_query
array and replace it withmeta_key => 'asg_branch_gvt', meta_value => $branch
It returns no problem.
What gives? Any ideas?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Using new meta_query with custom post types’ is closed to new replies.