WordPress Tip: How To Change The Number of Drafts Shown In Your Admin Panel

If you’re a WordPress user who typically has a ton of drafts, you know how painful it can be to be limited to viewing only 15 posts at a time in the WordPress admin panel. You are also probably aware that there is currently no option available to change this.
Update:This hack will only work in WordPress versions lower than 2.5. It will not work in WordPress 2.5 and above.
Below I’ve outlined two methods to allow you to change this limit and make the admin panel bend to your will. The first is a simple edit to one of the WordPress core files that just about anyone should be able to do in under two minutes. The second is a little more complex, but gives you the flexibility of adding an option to your Writing Options page so that you can change the number of posts shown in your admin panel whenever you feel like it.
Both methods require editing of WordPress core files, so make changes with care and understand that any changes you make will probably have to be reapplied the next time you upgrade WordPress.
The Easy Way: Edit Edit.php
- Go to your wp-admin directory and make a backup copy of edit.php, so that if you goof things up, you can easily revert back.
- Open edit.php and look for this line that starts with this:
wp("what_to_show=posts$post_status_q&posts_per_page=15... - Simply change the 15 to the number of posts that you would prefer to see and then save the file.
- Refresh your admin panel and you should see the number of posts available has changed to the number you requested.
The Less Easy Way: Add An Option To The Writing Options Page
This method lets you configure the number of posts shown by adding an option to your Writing Options page. It’s more flexible than the last method, but requires either rudimentary knowledge of PHP or good attention to detail. If these aren’t things that you possess, or you’re not willing to get your hands a little dirty, you may want to go back and try the first method instead.
Still here? Well, let’s get started.
- Go to your wp-admin directory and create backups of edit.php and options-writing.php.
- From your wp-admin directory, open options-writing.php.
- This file controls the Writing Options page in your admin panel. Around line 21, you’re going to see the
</tr>that marks the end of the row for the option that controls the size of the post box. Right after that</tr>, insert the following code:<!--Start custom option to control number of posts--> <tr valign="top"> <th width="33%" scope="row"><?php _e('Show at most:') ?></th> <td> <input name="admin_posts_per_page" type="text" id="admin_posts_per_page" value="<?php form_option('admin_posts_per_page'); ?>" size="2" style="width: 2em; " /> <?php _e('posts') ?></td> </tr> <!--End custom option to control number of posts--> - Near the bottom of the file, you will see a line similar to this:
<input type="hidden" name="page_options" value="default_post_edit_rows, use_smilies, ping_sites, mailserver_url, mailserver_port, mailserver_login, mailserver_pass, default_category, default_email_category, use_balanceTags, default_link_category" />On the end of that line, add
,admin_posts_per_pagebefore the final quote. Do not miss the comma. This will make sure that the number you type into the Writing Options page gets committed to the database whenever you change it. - You’re done with options-writing.php, so save it and close it out.
- Now, we have to tell the edit page to read the number of pages from our new variable instead of from the default static value. Open edit.php and find a line that looks like this:
wp("what_to_show=posts$post_status_q&posts_per_page=15...Replace the
15with$admin_posts_per_page. - Unfortunately, WordPress has no idea what
$admin_posts_per_ pageis yet, so you need to define it by inserting the following line above the line you edited in step 6:$admin_posts_per_page=get_option('admin_posts_per_page');This tells WordPress to grab the number of pages that you specify through the Writing Options page.
- That’s it. Close and save edit.php
This creates the input on your Writing Options page that will allow you to specify the number of posts you want to show.
You should now be able to specify the number of posts you want to see in the admin panel at any time through an option on the Writing Options page.
Share, Bookmark, or E-Mail This Article
October 17th, 2007 at 7:27 am
Good stuff. Is this something that could be implemented with a plugin or whatever it is that WordPress uses?
It’s simple little options like this that people like to have – you know you’re going to turn into a WordPress Tech Support Agent any day now. It’s like Geek Squad, only you don’t get to scour people’s PCs for porn.
October 17th, 2007 at 3:29 pm
Thanks for this…I’ll file this entry under “Things I will explore once I can figure out why WordPress keeps timing out on me”.
Do you by any chance have any tips on how to fix a blog that refuses to post to the future? I hear it might be something with my wp-cron.php file, or something with my host. I’ve contacted the host and I’m (very impatiently) waiting to hear back from them…hopefully they understand my question.
January 7th, 2009 at 2:07 pm
I was just wondering if you managed to figure it out for versions above 2.5 such as 2.7, which is the one I would like to adjust.