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
- Get date of last update outside of loop
- Pagination adding extra posts only on page 2
- If Loop has odd number of posts on last page Custom style for last post in it
- How can I use get_permalink() outside the loop?
- Category archive page – loop through posts of certain tag (with pagination) – pre_get_posts
- Two loops by pre_get_post on same page
- How to check for specific content in comments in the loop
- Problem the_permalink
- Can’t access login screen, wp-login.php 404’s
- Create static front-page with 3-5 recent posts
- Problems with loop
- Repeating Loop on my Posts Page
- Create a new query in function.php to filter blog posts
- Calling & display certain product category loop and pagination on the homepage
- Order by empty custom field
- Display Authors in a grid loop
- Infinite Scroll and DFP
- Get Page content to displayin Bootstrap Modal
- How to show more random posts if Tag has less than 3 posts
- Distribute Gallery Images Every nth in Loop
- WordPress Image Slider Looping Title Not Working
- Is there any good reason for two CSS files to @import each other?
- Random post link generator messes up the loop
- how can i order the category by date
- excerpt not showing up
- Announces with different formatting dependently on a number
- Override orderby to create list of users by custom meta_value
- Several loops in sidebar issues
- List page is showing 404
- Duplicated tag in loop
- Loop only shows first two posts
- Why is my archive page looping through all but one post?
- Loop two different category WP_Query
- WP_Query & Duplicate entries
- Transient not working for external data
- adding tax_query to $query_string
- Remove posts_orderby filter then add it back in
- the_title() Returns the page title instead of the post
- Conditional Check in The Loop’s Parameters
- How does the JSON API work to parse incoming JSON and fetch a post based on an ID?
- How to add excerpt in loop in Twenty Eleven theme?
- How to implement template file and the loop
- Show only posts from todays date [duplicate]
- Why did my most recent article fall behind an older one on my site?
- wp_mail function not working in user query loop
- How to set and retrieve cookies while in the loop