use
'orderby' => 'meta_value_num',
'meta_key' => 'post_views',
'order' => 'DESC',
instead of
'orderby' => array(
'post_views' => 'DESC',
),
your way is okay for string, but when you use number it is better to use meta_value_num
meta_value will sort number weird 1, 3, 34, 4, 56, 6, etc, rather than 1, 3, 4, 6, 34, 56 as you might naturally expect as codex explain
Related Posts:
- How to query serialized array by comparing greater than (>=)?
- Possible to create a permalink to sort with meta_key?
- Working Bootstrap Carousel Conversion to WP – Technical Questions
- Exporting Data from WordPress into a flat table
- What Is meta_id In wp_postmeta?
- Query posts by Author and/or by Tag
- Get other posts sharing the same meta values
- How to mark only one post as Featured post?
- Mix post date with post meta value using WP_Query
- WP_Query to get posts in a specific tag or has post_format
- How to create frontend Post filter using meta query
- Advanced Post Display/Pagination/Ordering
- How to use “Add link” pop up for a WordPress widget
- How to get all posts related to particular category name?
- Add tag to post api wordpress
- Add a new post status in the post progression
- How to add a quicklink to the Posts Admin Published|Scheduled|Trash menu
- Getting the Next and Previous Posts Titles in the Sidebar?
- Email admin when post pending?
- How to control which category will be picked for the slug of a post?
- How to hide the Text Area in the Post Edit screen
- upload image in a meta box
- Search posts by post author name
- Why is our post editor stuck at cols=40?
- Adding a Nav menu to post admin
- Mass Update lines of code for all posts
- Adding Multiple Values to a Post Meta Key
- get custom image size
- Does an article (post) id ever change?
- Check is_single() outside loop
- Only display a certain number of posts, dependent on how many posts there are available in a query
- how to replace embedded “full” sized images within a post with the “large” ones
- Change default Posts page
- Batch process: remove first image from post content
- Create post for every user?
- Facebook Share Thumbnail
- How to pass Post_ID variable from theme’s Single.php to custom Plugin using AJAX
- Yearly archive page for future year
- How blog page in WordPress works : blog page retrieve first post ID
- Delete WordPress posts from URL list sql query
- Posts with multiple authors with different roles
- Custom WordPress Theme: Publish Date and Display Date for posts right beside each other
- How to change permalink on post click on post listing page
- Blog post per page setting conflicting with custom WP_Query?
- Show certain posts in a LIST format that members have been granted access to
- WordPress Rest API Create Post
- WordPress custom Query for Posts in Category display posts multiple times
- performance of post_exists
- Add a custom meta box in the post options that loads some html code in the header
- How would one change the default url structure of attachments?
- Use two different post_per_page limits with infinite scroll
- A/B testing of posts with unique URLs for each variant AND editing in custom fields
- How to dynamically parse and transform post/page content before displaying it?
- WP move posts to different path
- getting “Object of class WP_Post could not be converted to string” – when it is a string
- How to get posts published on the latest date?
- how to set social icons to product / post template (Auros theme)? [closed]
- Change the color of the Password Protected Post titles
- Bolding several words at once
- Post Form Results to Table in Same page
- I don’t want the complete article to show on homepage
- wp_query if have posts show date but not in loop
- Get posts from current category?
- Send email to admin with post author
- posts going to 2 pages/categories only show up in 1
- How do I get the image that is submitted with a post, when I’m in the loop?
- How to output all taxonomy links from a custom post type in a menu?
- Cannot create new posts or upload images using media manager
- How can i showcase all my galleries?
- Rewrite image links from attachment id to attachment link
- How do I change the template specifically for single posts?
- wp-insert-post execute from server?
- Change the size of the featured image for post?
- Send email to user when I publish a new post
- Change URL of previous posts and next posts link in WordPress
- Fill the exclude array() in get_posts()
- Prevent Archive URLs
- Dev and prod on the same database- dev version active for IOS
- Prevent WordPress from putting around specific element
- How to correctly escape data
- How to fetch posts that are stored in the different table than the default table (wp_posts)?
- Update user meta when post published no working
- Custom layout manager for posts
- Get posts by category or author
- How to make post button to a random post
- I moved my site to another server, wp admin works so does the front page, but posts don’t work
- How can I have the posts from one word press blog show on the presentation page of another word press site
- Where is object, property or label in the database that controls the order of the posts being displayed?
- Display the popular tags by default in the backend post edit page (without having to click on the link that displays them) [closed]
- How to get single post by one author?
- Latest posts on all pages
- Getting 404 when using rewrite rule for posts
- Posts and pages not getting published
- How to create a post based on data in a table?
- Display all posts from selected month
- How to show only the date, the title and a little “summary” of my WordPress post in my custom theme?
- Permalink remain the same on each page
- How does WordPress add the comments and comment form to posts
- How to get post ID after removing that post?
- I cannot see the pagination in /wp-admin posts page