How to Display More Than 15 Recent Posts in WordPress: If you want to display more than 15 recent posts in WordPress, the good news is that current versions of WordPress no longer require the old 15 post limit workaround. The built in Recent Posts widget now allows you to enter the number of posts you want to display. If you want to show 20, 25, or another number of recent posts, you can usually set that directly in the widget settings.
If you need to force the Recent Posts widget to display a specific number of posts, you can also use a WordPress filter instead of modifying WordPress core files.
This tutorial covers both approaches:
- Modern method: Use the
widget_posts_argsfilter. - Simple method: Set the number directly in the Recent Posts widget.
- Legacy method: The original WordPress 2.8-era technique for changing the old 15-post limit in
wp-includes.
How to Display More Than 15 Recent Posts in WordPress
For most current WordPress installations, start with the built-in Recent Posts widget.
Go to:
Appearance > Widgets
or, depending on your theme and WordPress setup, open the widget area through the Customizer or your site's widget management interface.
Find the Recent Posts widget and look for:
Number of posts to show
Enter the number of recent posts you want displayed.
For example, if you want to display 20 recent posts, enter:
20
Save or update the widget.
That's all that is required on current WordPress versions when the widget's number field is available.
Modern Method: Use a WordPress Filter
If you want WordPress to automatically display a specific number of recent posts, you can use the widget_posts_args filter.
This is a safer approach than editing WordPress core files because the code can be placed in your child theme's functions.php file or, preferably, in a site-specific plugin.
For example, the following code forces the Recent Posts widget to display 20 posts:
add_filter( 'widget_posts_args', function( $args, $instance ) {
$args['posts_per_page'] = 20;
return $args;
}, 10, 2 );
The important setting is:
$args['posts_per_page'] = 20;
Change 20 to the number of posts you want.
For example:
$args['posts_per_page'] = 25;
would request 25 recent posts.
WordPress provides the widget_posts_args filter specifically for modifying the query arguments used by the Recent Posts widget.
Where Should You Add the Filter?
You have several options.
Recommended: Add it to a small site-specific plugin that contains your custom WordPress functionality.
Also suitable: Add it to the functions.php file of your active child theme.
Avoid adding custom code to the WordPress core files in wp-includes.
If you are already maintaining a custom functionality plugin for your site, that is generally the cleanest place for this type of filter.
Example: Always Display 20 Recent Posts
Use:
add_filter( 'widget_posts_args', function( $args, $instance ) {
$args['posts_per_page'] = 20;
return $args;
}, 10, 2 );
After adding the code, clear any applicable WordPress, page, object, or server cache and check the Recent Posts widget on the front end.
Example: Display 30 Recent Posts
If you want to show 30 recent posts instead, change the value:
add_filter( 'widget_posts_args', function( $args, $instance ) {
$args['posts_per_page'] = 30;
return $args;
}, 10, 2 );
The Recent Posts widget passes its query arguments through the widget_posts_args filter before WordPress runs the query.
Why You Should Not Edit wp-includes
The original version of this tutorial recommended modifying:
wp-includes/widgets.php
That was a practical solution for older versions of WordPress, but it is not a good approach for a current WordPress site.
WordPress core files are maintained by WordPress itself. A future WordPress update can replace modified core files, which means your changes can disappear.
Using a WordPress filter avoids that problem.
Your custom code remains separate from WordPress core, making it easier to maintain and update your site.
Legacy Method: Change the Old 15-Post Limit
The following section preserves the original method from this tutorial for historical reference and for older WordPress installations.
Important: Do not use this method on a current WordPress installation unless you have a specific reason to maintain an old WordPress version.
Older versions of WordPress limited the built-in Recent Posts widget to 15 posts. The original workaround involved modifying the WordPress core widget code.
1. Back Up the WordPress Core File
Using your preferred FTP application or server file manager, navigate to your WordPress:
wp-includes
directory.
Locate:
widgets.php
Make a backup copy before making any changes.
Note: Modern WordPress stores the Recent Posts widget implementation in a dedicated file under wp-includes/widgets/, so the exact file structure differs from the WordPress version targeted by the original tutorial.
2. Find the Old 15-Post Limit
In the older WordPress code targeted by the original tutorial, you would find code similar to:
$title = empty($options['title']) ? __('Recent Posts') : $options['title'];
if ( !$number = (int) $options['number'] )
$number = 10;
else if ( $number < 1 )
$number = 1;
else if ( $number > 15 )
$number = 15;
The important part was:
else if ( $number > 15 )
followed by:
$number = 15;
The old workaround changed the value of 15 to a higher number, such as 20.
3. Change 15 to 20
For the old WordPress implementation, you could change:
$number = 15;
to:
$number = 20;
This increased the maximum number of posts permitted by that older widget implementation.
4. Change the "At Most 15" Text
The original tutorial also instructed users to search for:
at most 15
and change it to:
at most 20
This changed the text displayed in the older WordPress widget settings interface.
5. Upload the Modified File
Save the modified file and upload it back to the appropriate WordPress core directory.
The old tutorial then instructed users to return to:
Design > Widgets
and set the Recent Posts widget to the new maximum.
Which Method Should You Use?
For a current WordPress website, use the built-in widget setting whenever possible.
If you need to automatically enforce a specific number, use the widget_posts_args filter.
The old wp-includes modification should be considered a legacy WordPress 2.8-era technique, not the preferred solution for a modern site.
Does WordPress Still Limit the Recent Posts Widget to 15 Posts?
Not in the current built-in Recent Posts widget.
The current WordPress widget form provides a numeric Number of posts to show field without the old max="15" restriction. The current Recent Posts widget also uses the requested number as the posts_per_page value for its query.
That means the original 15-post workaround is no longer necessary for current WordPress versions.
How to Display 20 Recent Posts in WordPress
If your goal is simply to display 20 recent posts, open the Recent Posts widget and enter:
20
in the Number of posts to show field.
If you want WordPress to enforce 20 posts regardless of the widget setting, use the filter:
add_filter( 'widget_posts_args', function( $args, $instance ) {
$args['posts_per_page'] = 20;
return $args;
}, 10, 2 );
If the Recent Posts Widget Is Not Showing More Posts
If you entered a larger number but do not see additional posts, check the following:
- There may not be enough published posts. The widget cannot display more published posts than are available.
- Check the widget settings. Make sure the number of posts is actually set to the desired value.
- Clear your cache. A page cache, object cache, CDN, or server cache may still be displaying an older version of the sidebar.
- Check your custom code. Another plugin, theme function, or filter may be modifying the Recent Posts query.
- Check your theme. Some themes replace or customize the standard WordPress Recent Posts widget.
Does Showing More Recent Posts Help SEO?
Displaying more recent posts does not automatically improve search rankings.
However, a Recent Posts widget can provide additional internal links to your content. If those links are useful to visitors and help them discover relevant articles, they can improve site navigation and content discovery.
There is also a practical UX consideration.
Displaying 20 or 30 posts in a sidebar can make the page longer and more cluttered. If your goal is simply to expose more content, consider whether a category archive, related-post section, search feature, or dedicated recent-posts page would provide a better experience.
In other words, increase the number of Recent Posts because it helps your visitors, not simply because a larger list contains more links.
The Original WordPress 2.8 Method
This tutorial originally addressed an older version of WordPress where the Recent Posts widget had a hardcoded maximum of 15 posts.
The original solution was to modify the widget's core PHP file and increase the maximum value.
That information is retained here because older WordPress tutorials and references may still point users toward the 15-post limitation.
For modern WordPress websites, however, the core-file modification is unnecessary.
The safer approach is to use the widget's built-in number field or the widget_posts_args filter.
How do I display more than 15 recent posts in WordPress?
On current WordPress versions, open the Recent Posts widget and increase the Number of posts to show value. You can also use the widget_posts_args filter to control the number programmatically.
How do I display 20 recent posts in WordPress?
Set the Recent Posts widget's Number of posts to show value to 20. If you want to force the setting with code, use the widget_posts_args filter and set posts_per_page to 20.
Can I show more than 15 posts in the WordPress Recent Posts widget?
Yes. The current Recent Posts widget does not use the old 15-post maximum found in older WordPress versions.
Should I edit wp-includes to increase recent posts?
No. Editing WordPress core files is not recommended for a current site. Use the widget setting or a WordPress filter instead.
What filter changes the WordPress Recent Posts widget?
The built-in widget_posts_args filter lets you modify the query arguments used by the Recent Posts widget.
Why is my WordPress Recent Posts widget not showing more posts?
Check the widget's number setting, make sure you have enough published posts, clear your caches, and check whether another plugin or theme is modifying the Recent Posts widget query.
Final Thoughts
If you are using a current version of WordPress, you no longer need to modify the old 15 post limit.
For most sites, simply change the Number of posts to show setting in the Recent Posts widget.
If you need more control, use the widget_posts_args filter.
The original core-file method is preserved above because it was the solution used by older versions of WordPress, but it should generally be treated as historical information rather than the recommended method for a modern WordPress installation.
