The correct query is:
$args1 = array(
'showposts' => 5,
'ignore_sticky_posts' => 1,
//ORDER ARGUMENTS
'meta_key' => 'post_views_count',
'orderby' => 'meta_key_num',
'order' => 'DESC',
//META QUERY
'meta_query' => array(
array(
'key' => '_simple_fields_fieldGroupID_2_fieldID_1_numInSet_0',
'compare' =>'NOT EXISTS' ),
),
);
$popularposts = new WP_Query($args1);
The order aguments are always outside meta_query
, see the codex.
Related Posts:
- Best approach to create Hot and Trending sections
- Show most popular post of last 12 months
- Most popular post for last 7 days
- Display most popular in the past two days
- Get a page ancestor from a most viewed list
- meta_query ‘compare’ => ‘IN’ not working
- Use the page slug in a WP_Query?
- Sorting: custom query with orderby meta_value_num THEN by title
- WP_Query and next_posts_link
- Using OR conditions in meta_query for query_posts argument
- Get posts by menu ID
- count posts from custom taxonomy terms by year
- Woocommerce query by price range and custom meta key
- Get posts with condition on comment meta value
- WP_Query sort by comment meta data
- Stop all SQL_CALC_FOUND_ROWS wordpress queries
- Move posts to top of WP_Query if in certain Taxonomy?
- WP_query ‘orderby=none’ Problem
- How can I create a WP_Query that returns posts where one meta_value
- ‘paged’ in wp_query doesn’t work
- Sorting meta_value as integer doesn’t work
- Display different number of posts from one category on the different pages
- How to display child posts in the parent category
- Get posts from the Main site to sub site – WordPress MultiSites Network
- Custom Field Query – Meta Value is Array
- WP_Query for showing specific post by id
- Ordering by meta_value AND date NOT WORKING with wp_query
- Transient caching for wp query
- Query by custom dates in UNIX Time
- Custom WP Query from meta_value stored as serialised array
- Get List of all the Authors
- How to check if a post “does not have term” in conditional statement?
- WP_Query returns more results than expected
- Make WP_Query more efficient?
- Set order of returned items in the WP_Query() class/function
- unable to retrive parent page information
- Which method is faster to get a single post?
- Site not getting correct featured image from my query
- Using WP_Query within an mu-plugin
- Use more than one query, but prevent duplicates – at scale!
- WP Query related posts by tags
- How to add posts, manually, to a wp_query?
- wp_reset_postdata() does not work as expected
- Search Query for multiple categories using ‘OR’ but having certain categories be ‘AND’
- WP_query with OR relation between args[‘s’] and arg[‘meta_query’]
- add_filter(‘query_vars’) not working in custom template
- Avoid repeated post on page 2 when excluding one on page 1
- Stale $GLOBALS[‘post’] after custom WP_Query empty result set bothers my template, whose fault is this?
- How to count posts with specific arguments
- Why post__not_in is ignored?
- find posts that don’t have a custom taxonomy
- Woocommerce pagination and result count after custom loop
- Error with function in functions.php?
- I am having problem sorting custom post type using WP_Query
- WP_Query and is_page_template() conditional
- Exclude recently updated post from custom WP_Query using multiple loops
- get_posts output always same post
- WordPress Custom Search Form Displaying Unexpected Results
- difference between querying database and using the loop
- Stomping WP_Query in author archive to facilitate pagination with custom queries
- How to do logical OR in terms in WP Query?
- Limit number of posts in loop
- How do I get Woocommerce product variation name and variation description in a WP_Query?
- Slow Query On Search
- Loop posts based on permalink term
- Does putting queries within loops cause an issue on WordPress?
- How to get current page nearest parent id?
- How to create Page templates for showing Blog posts in different layouts?
- wp Query Posts to display in Nivo Slider
- How to get only ONE category of “Portfolio” posts to display on main page rather than ALL categories?
- Determining what post is displayed out of total posts found
- Strange behaviour of hierarchical taxonomy archive
- Is it normal that get_post() gets run 300 times and the content of those posts aren’t visible?
- How to sort wordpress posts already selected by WP_QUERY
- WordPress Sub Category Archive, Show Extra Empty Page Number in Pagination
- Doing $wpdb->get_results returns NULL, doing the same query in my DB returns correct value
- SEARCH QUERY PLEASE HELP | call_user_func_array() expects parameter 1 to be a valid callback php
- How to get meta key list efficiently?
- Get posts having meta value between two numbers
- Merge wp-query and get_users
- WP_Query how to add a thumbnail to the first post from the last 5 posts?
- How order by works?
- taxquery taxonomy get terms
- Separate by Category Post Type
- Using modified ‘meta_key’ to set ‘orderby’ in WP_Query?
- WP_Query don’t working with fixed post_id and term_taxonomy
- Query posts in current category but not attachment format
- WP_Query with Pagination and orderby meta_value_num showing duplicates
- Using orderby with 2 meta keys
- wp_query – Modify $query to include duplicate content
- Query to get all the posts of more than 2 meta_value having same meta_key?
- Slow getting posts from category
- Query specific number of posts for each post type in specific order
- Avoiding page loop
- Query Users by post count, last 30 days and display each users post count according to post type
- how do I exclude child categories from a wp_query?
- How to create a loop inside WP_Query?
- how to show only catergory titles on a page in wordpress
- How to get all post_id and meta_value using meta_key in wp_postmeta table
- List categories using WP_Query