Is it possible to use WP Query to orderby custom meta value and custom taxonomy?

I have the similar query in my blog. This my args array : $args= array( ‘post_type’ => ‘box’, ‘posts_per_page’ => -1, ‘meta_key’ => ‘position’, ‘order’ => ‘DESC’, ‘orderby’ => ‘meta_value_num’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘taxonomyname’, ‘field’ => ‘slug’, ‘terms’ => ‘yourterm’ ) ) ); Hope it will help you

loop and in admin header problem

Move the query part to a separate function that returns the data you need: function rs_get_scripts_data(){ $array = array(); // query + add stuff to array return $array; } and use it with wp_localize_script like: $array = rs_get_scripts_data(); $myscript_vars = array( ‘array’ => $array ); wp_localize_script( ‘myscript’, ‘myscript’, $myscript_vars );

Using Query In Post Type Archives

Change it from: ‘category_name’ => celebrity, ‘orderby’ => 1, into ‘category_name’ => ‘celebrity’, ‘orderby’ => ‘date’, // or something else Otherwise celebrity will be treated as a constant name, not a string. Also, you can’t order by 1, you have to use one of the ordering parameters.

Listing all custom post types using a specific term on the said term’s template page, in groups

Your code, when working, will consume sooo much resources. When implemented in this way – throught custom page template, WordPress will call for a content of that page (1 query) and after that it will call a query for each custom post type – another 4 queries. That’s a lot, really. I would suggest you … Read more

WP_Query: Fetch posts that are in (category1 and not in category2), OR posts that are not in cagegory1

Here we go, try a tax_query instead http://codex.wordpress.org/Class_Reference/WP_Query#Taxonomy_Parameters … ‘tax_query’ => array( ‘relation’ => ‘OR’, array( ‘taxonomy’ => ‘category’, ‘field’ => ‘slug’, ‘terms’ => array( ‘event’,’show_on_front’ ), ‘operator’ => ‘AND’, ), array( ‘taxonomy’ => ‘category’, ‘field’ => ‘slug’, ‘terms’ => array( ‘event’ ), ‘operator’ => ‘NOT IN’ ) )

direct custom post query interferes with other queries on page

You might be looking for wp_reset_query You would insert this after your return. add_filter(‘pre_get_posts’, ‘query_post_type’); function query_post_type($query) { if($query->is_category() || $query->is_tag() || $query->is_home() && $query->is_main_query()) { $post_type = get_query_var(‘post_type’); if($post_type) $post_type = $post_type; else $post_type = array(‘post’,’my_custom_post_type’); $query->set(‘post_type’,$post_type); return $query; } wp_reset_query; } I really hope this helps.