More Than 15 Recent Posts On WP Widget

Important: This is an old post…I don’t recommend you hack away at WordPress core files!

On WordPress the maximum of recent posts you can show on the “Recent posts” widget is 15 posts. However, some people may want to show a lot more than 15 recent posts on their sidebar.

Luckily, it is really simple to increase the amount of maximum recent posts allowed,  by manipulating the default-widgets.php file from your WordPress Installation.

The following little tutorial will show you how to increase the max recent posts to 30 posts.

Show More than 15 Recent Posts

1. Access your server via FTP (I use Firezilla)

2. Navigate to the following file: default-widgets.php (located at /public_html/wp-includes)

3. Drag this file onto your desktop and open with a text editor such as notepad or you can use dreamweaver if you prefer.

6. Locate the following piece of code (with notepad its easier to use the search tool):

if ( !$number = (int) $instance['number'] )
 $number = 10;
 else if ( $number < 1 )
 $number = 1;
 else if ( $number > 15 )
 $number = 15;

7. Change the instances of 15 to 30 (or whatever maximum posts you want)

8. Now locate the following occurrence:

at most 15

9. Change this to say at most 30 (or whatever number you chose)

10. Now when you visit your widgets section you will see that the default maximum recent posts amount has been changed according to your preference.

AJ Clarke
Post Author: AJ Clarke

Hey. My name is AJ and I am the boss around here. I own and operate WPExplorer. A website dedicated to everything I love about WordPress.

Disclosure: This page contains external affiliate links that may result in us receiving a comission if you choose to purchase said product. The opinions on this page are our own. We do not receive payment for positive reviews.

Leave a Reply