You don’t need the sort within the loop if you pass the correct orderby
argument. You’ve got order_by
with an underscore, where it should be orderby
, no underscore.
You can then set paged
to the page number you want, and posts_per_page
to however many you want on each page. Right now you don’t set a page number to retrieve, so you’re always going to get the same set of posts.
Have a look at pagination parameters on WP_Query
Codex page.
Related Posts:
- Should we trust the post globals?
- Get first post from wp_query
- WP_Query: Why is sticky post not first item in loop?
- Query *only* sticky posts
- get comments and get posts in loop
- How do I reorder (pop and push) items from WP_Query?
- How to exclude latest x posts from a paginated query?
- How to query serialized array by comparing greater than (>=)?
- How to know if get_posts() failed?
- Reverse chronology of post listing
- How to get previous 10 days post from a specific date – WP Query
- WordPress Number of Posts Not Changing With posts_per_page
- This AJAX Code Doesn’t Work – Looking for elegant solution
- Specific loop in Shortcode
- Search widget breaks when using multiple loops?
- Converting multiple loops into one single loop with pagination
- Display posts with comments closed, with pagination?
- Group posts by year in loop
- How would I get 1 latest post from a query for 5 posts?
- Loop through all product posts?
- WP Query – duplicated posts once including tags in search results
- get_next_post() and get_previous_post() return wrong posts
- Display post from current category and same tag?
- Inserting custom data to the_post() during loop
- How do I restart my loop with get_next_post()?
- Why WP_Query(‘showposts=5’) shows only 1 post?
- Blog post per page setting conflicting with custom WP_Query?
- How to exclude latest x posts from a paginated query?
- WP Query – Posts Per Page not working in combination with category__in
- Pausing and Resuming WP_Query results
- Post Loop Missing Most Recent Post
- How to : pagination in 3 different custom loops on the same page
- Pagination with an array of post objects?
- List authors with the last post title and order by last post date
- wp_query random post
- how to get post order by post id wp_query?
- Possible to alternate between two loops
- How to get posts published on the latest date?
- Why posts array is empty?
- Page and post loop same template
- Getting blog pagination to work on page set as front page
- Display current post position in Elementor Posts widget
- How to give classname to post if post has no content?
- WP_Query: Show 10 posts in date order, first three random
- WordPress Loop: How to display recent posts in multiple divs
- Querying another post category to match current post and display in loop
- Related Posts function not working
- How to display post list in a table layout (multiple queries in single loop)
- Not all posts showing in query
- how to handle the loop using filling bootstrap grid structure?
- Custom WP_Query not working correctly
- WP_Query of Category Not Showing First Post
- Display 3 posts with different HTML markup using a loop
- How to show multiple posts thumbnail, title and date in widget
- While loop in functions.php outputting the_title() of each post on frontpage
- Display specific posts based on an ID of another post
- Numbered Pagination Showing The Same Posts After Altering WP_Query
- show loop id post , only first id can read
- Fill the exclude array() in get_posts()
- Double loop output
- Loop through all posts showing duplicates
- Wp_query loop is not working as it should
- WordPress text field in array problem
- How to get all posts in gallery post format template
- WordPress loop uses unmodified posts array, why?
- Advanced Post Display/Pagination/Ordering
- Why I obtain this WP_Query strange behavior trying to select posts having a specific tag?
- How to show the posts list into a static page? Problems to use the loop into a static page
- Retrieve latest post by multiple categories with ID
- Adding a category at even positions on main loop with modified pagination
- Make assigning post to a specific category equivalent to assigning it to all categories
- Displaying posts on Homepage
- How to get single post by one author?
- How do I show the post title if an advanced custom field hasn’t been used?
- First post in loop displays twice
- View post with specific category id and name which I selected in the backend (drop-down option)
- Adding additional data to WP_Post object
- Showing random content / pictures from earlier posts in a sticky post?
- wp query with dynamic taxonomies and terms?
- Automatic value for custom fields for posts
- How to find what index page a post is on?
- Get Posts that are in the current month or later
- WP Query to Get Array of Slugs
- Displaying Latest Posts on a Page
- Display all posts that were published before full post on single.php
- Hiding Draft Post In Admin
- Only display sticky post or latest post in custom loop
- Ignore latest two posts
- Grid post page on WordPress with Bootstrap, the_excerpt(); Problem
- Loop parent terms {display posts} AND loop child terms {display posts}
- Print out last 3 blogposts
- On what hook can I get the queried object’s final state?
- Get all custom posts with a certain taxonomy
- Limiting the amount of posts retrieved by the loop
- Magazine style frontpage with multiple categories/loops and no duplicate posts
- get_next_post() not working with future post status
- Change archive results based on GET request
- How to control Post view count incresing in sidebar widget posts too?
- Multiple Post Repeat for Related Post Loop by Category
- Where should get_post_meta() go to get $post->ID get_post_meta() is empty and $post->ID & get_the_id() are working