How to Increase the Number of Recent Posts in WordPress
Many of us struggle with the limitation of the number of recent posts in wordpress. The maximum with the latest is 15 most recent posts.
I like to increase this to about 100 because this improves the site structure and gets the search engine bots from the homepage to the internal pages through the most recent post links on the front page.
So lets try to increase the limit to 100 recent posts….
You got to be careful about the maximum number here because of 2 reasons
1. It delay the site load time because the site has to load all the links, and
2. SEO says more than 100 links on the home page is a bad idea !
It’s a bit of a pain to do this because you need to modify the default-widgets.php located in wp-includes
Before you play with the file make sure to BACKUP
I am not responsible if anything goes wrong !
Find the code below
$title = apply_filters(‘widget_title’, empty($instance['title']) ? __(‘Recent Posts’) : $instance['title']);
if ( !$number = (int) $instance['number'] )
$number = 10;
else if ( $number < 1 )
$number = 1;
else if ( $number > 15 )
$number = 15;
and modify to
$title = apply_filters(‘widget_title’, empty($instance['title']) ? __(‘Recent Posts’) : $instance['title']);
if ( !$number = (int) $instance['number'] )
$number = 10;
else if ( $number < 1 )
$number = 1;
else if ( $number > 100 )
$number = 100;
if you have setup widgets for the sidebars then modify the maximum number of recent posts to display to 100.
Before the hack you could put any number, even 100, but it simply ignored it and displayed the 15 recent posts because the code we modified is actually what controls this maximum number
else if ( $number > 100 ) $number = 100;
Hope this is useful, feel free to leave comments below…