The post limit is controlled in the admin panel, at Settings > Reading
. There you can set the limit for how many posts should be shown in a query. However, the default post count for get_posts()
is 5.
If you would like to query unlimited posts (regardless of performance issues), you can either create your own instance of WP_Query()
or use the pre_get_posts
filter to do so.
Using WP_Query()
is pretty straight forward, and all you have to do is to pass -1
to the query. You can do the same with get_posts()
:
$args = array (
'posts_per_page' => -1,
// Rest of the arguments here
);
$query = new WP_Query($args);
Now you can use a simple while()
loop to output your content.
Related Posts:
- How to identify and hide/remove an element from a WordPress page [closed]
- Get Posts Under Custom Taxonomy
- How to show related posts by category
- get_children() Not Working with orderby Parameter
- How to get all posts related to particular category name?
- get all posts ID from a category
- Display all posts from specific categories on a page
- get comments and get posts in loop
- How to know if get_posts() failed?
- How to display posts by current user/author in a custom page template?
- How to get previous 10 days post from a specific date – WP Query
- Post X of Y in single.php / sidebar.php
- Show the title of the latest post by author
- Setting pagination for images attached to a post
- Query only Posts from Both of Two Category?
- How do I change the gallery that is inserted in the post?
- is there a better way of combining this?
- Accessing $post variable from template part
- how to show all post in my page-grid.php template page
- How to get new post URL?
- WordPress get posts by date without query_posts
- WordPress theme ajax have_posts()
- New blog template to display only one category
- Convert a complex webpage into WP theme
- Posts are not showing up on particular category
- get selected post using $_GET
- How Can i Get 5 Recent Post Title With Corresponding Link?
- Submitting POST data to a custom page template triggers a 404, why?
- Can I set and show “important” post in my blog?
- setup_postdata doesn`t seem ot be working
- Encrypt / Decrypt Post Title and Details
- Get Posts via Taxonomy Term Name with Space
- Get specific posts by ID in wordpress
- Creating a Page of Posts
- Dynamically generate child-URLs for posts or custom posts
- Animated gif for a thumbs
- Posts vs. Pages
- Automatically republish old posts
- get_next_post() and get_previous_post() return wrong posts
- Replace ‘published on date’ with ‘modified on date’ on Posts
- Why orderby=”date” does not support manually changed posts?
- Get posts by name and taxonomy term
- What is the standard featured image size?
- Inserting custom data to the_post() during loop
- How do I restart my loop with get_next_post()?
- Get mixed category random posts
- WordPress not opening posts with only numbers if permalink is post_name
- How to display posts on a static page? (like search loop)
- Limit popular posts by days
- How to show single post page as home page
- Why is querying posts messing up my pages?
- get_the_content(“more…”) returns full text
- Why aren’t my posts/pages showing up in my WordPress Theme?
- Blog page not working
- Insert Content In Between Post Feed
- Post Loop Missing Most Recent Post
- Get Posts Under Custom Taxonomy
- Include sticky posts on the static page front page
- Get attachments for posts that belongs to a specific category
- Pagination with an array of post objects?
- How to change the color theme per post?
- Any way for get_next_post() to use the actual post order instead of publish order?
- How safe is renovating $wp_query when doing WP_Query pagination in Page Template
- how to show single post in a custom template
- Highlight static blog page link in header
- How to create a template for Pages?
- Remove Content after
- Posts loop displaying the same post data
- Shortcodes on my website stops working after theme update [closed]
- How to get posts from a current post’s month?
- How to get posts and comments amount per hour, per year and per month?
- While loop articles – if statement order
- Count number of posts of current month
- posts not showing on index.php
- Page template is accessing the incorrect posts?
- How to Get Posts, Including Private Ones?
- Block editors annoying warnings
- WordPress website loads more posts than expected
- Random posts from a pool of posts
- Proper way of establishing custom landing pages in WordPress
- Conditional Tag for has post [closed]
- Hide a specific post from a page template
- How to Use index.php file for “Blog” Page And this is Not a Home Page
- How to get post content from an array of ids?
- Display Posts with template on a Page
- Number of displayed posts
- Why posts array is empty?
- How to create a “latest news” page showing a list of posts from blog category
- How to change the layout of posts when viewing all posts by tag [closed]
- Post Filtering by GET URL parameters
- How to give classname to post if post has no content?
- Images showing up in Post Editor, but not in Published Post
- How to create a page that shows the last 10 posts?
- $_GET parametters not working in an specific template
- Getting Whitescreen when publishing a post [closed]
- Related Posts function not working
- How to get post with slug and exclude categories
- get_posts not pulling the correct number of posts
- Get x recent posts by author?
- How do I link a Post Type to a Template in Masterplan?