Try this:
$args = array(
'post_type' => 'post',
'posts_per_page' => 3,
'meta_key' => 'post_views_count',
'orderby' => 'meta_value_num',
'order'=> 'ASC',
'date_query' => array(
array(
'after' => '30 days ago'
),
),
);
$query = new WP_Query( $args );
You can’t directly order by met_key’s name, you need to use it the way it is above.
Related Posts:
- How to fix pagination for custom loops?
- Remove the Homepage Query
- Is `query_posts` really slower than secondary query?
- Are there any scenarios where the query_posts may be used?
- Transient not working for custom loops
- post loop causes wp_users and wp_usermeta DB queries for each users
- get_the_foo() in the loop – does it perform another query?
- If No Search Results, Show Posts from Alternate Search Query
- How to Loop within a Loop (Display Children and then Grandchildren)
- Loop posts only excluding first post
- Loop after page content
- A loop with all articles with certain text strings in tags
- Query posts if meta key starts with
- 3 Posts in Loop, Show Stickies First
- How to go about combining dropdowns / filter queries?
- Query reset problem or flawed code to enable custom post type query
- Query last updated posts (posts updated in the last 24 hours)
- Conditional query that displays on Woo product attribute pages
- How do I use AJAX Query in my posts loop?
- woocommerce get_price_html not pulling in correct price
- How to fix pagination for custom loops?
- How can I paginate this?
- How to display posts by vote count and if no value continue with latest posts with no votes?
- How to fix pagination for custom loops?
- Split wordpress loop to multiple layouts
- Making a query to the DB using same parameters of loop
- Loop inside query
- get_delete_post_link() inside Loop stubbornly returns nothing
- loop inside the foreach
- Query posts only with actual text content (not including shortcode or images)
- Exclude posts based on an array
- Query post & loop problem.
- Loops for cat links not looping for wordpress site
- How do I set the Stewart Search Template to return only published posts in the result
- Trying to get all links in my posts
- Custom Query with Sticky Posts
- Build a Page which shows the Oldest Post with specific Custom Field Value
- Query posts and display all dates in repeater field in chronological order
- How to fix pagination for custom loops?
- Get featured image outside the loop using foreach
- Alternative layout the loop
- Show posts by tags excluding current post
- Strange problem with wp_get_attachment_image_src database (db) query count
- Next 10 posts data of currently viewing post in blog page
- How to fix pagination for custom loops?
- How to fix pagination for custom loops?
- How to fix pagination for custom loops?
- Get query result before posts are displayed?
- Combine Query and Select Database to create directory loop
- WordPress loop: Display if posts exist
- wordpress showing all posts instead of date range
- Multiple loop with pagination in same page
- Query Loop Block: possible to restrict just child pages?
- Use Base-URL with Query-Loop
- Using Query Loop Block to list all posts under each category
- Counting the posts of a custom WordPress loop (WP_Query)?
- Pagination not working with custom loop
- Is it necessary to reset the query after using get_posts()?
- Is there any difference between the_title() and echo get_the_title()?
- Pagination not working on home page
- Get ID of a page containing secondary loop in content
- is_home, and is_front_page conditional problem
- Exclude category by slug for for each loop
- WordPress Loop Through Particular Pages
- Transient pagination not working properly
- Display date only once for a each set of posts relating to that date
- The main Loop is not starting in a custom blog template page
- connect last post with first post
- Chopping up a large ajax request of around 200 posts [closed]
- Combining the_excerpt with the_content
- Custom loop with conditional statement to separate each terms
- Breaking the loop?
- How to get an array of years from all of the search results, and use it to filter by year the paginated loop?
- trouble calling an import class from an action in a plugin before wp_cron executes
- Obtain page data and use regular loop
- How can I load posts starting from, and including, the current post?
- Is wp_reset_postdata() redundant after the main loop?
- Exclude first post (sticky or not) from the loop using query_posts()
- While loop with bootstrap [closed]
- Need to add class to first element in a foreach loop
- Scrolling Posts with Ajax
- Sort posts by first letter in the title, not by first number
- how to replace get_template_part(‘loop’,’tag’) with explicit styled version?
- WordPress query undefined offset in loop
- Grabbed Post ID under WP loop, but still couldn’t Print Post title
- How to separate posts loop in to two columns? [duplicate]
- Blank content php code not parsing advanced custom fields gallery add-on [closed]
- Using jQuery .after inside loop
- Page Navigation Outside the Loop
- How to loop specific Category menu from archive page?
- How can I pass additional params to a shortcode while in a loop?
- Exclude posts from loop by term
- Why loop renders only last metabox from array? [closed]
- Structure and Display Content from Multiple Pages on Single Page
- Creating a archive for taxonomy terms, not the term results
- meta_query dates from an array
- Loop to get current parent page “content” and his children content
- Detecting top parent category fails on home page
- Add Div IDs dynamically to CSS
- Two loops in CPT archive page, exclude posts from main query