WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to remove pagination by changing the default screen option value for posts per page, pages per page and media items per page, in the admin area, to 999. The default value is set to 20. I found the answer I need (I have pasted below from @KrzysiekDróżdż's answer in this question: Change default screen option value for posts per page) but am looking to also add a filter for the media library so it's consistent for all areas of the admin.

function my_edit_per_page( $result, $option, $user ) {
    if ( (int)$result < 1 )
        return 20; // or whatever you want
add_filter( 'get_user_option_edit_page_per_page', 'my_edit_per_page', 10, 3 );  // for pages
add_filter( 'get_user_option_edit_post_per_page', 'my_edit_per_page', 10, 3 );  // for posts

I've tried these, to no avail:

add_filter( 'get_user_option_edit_media_per_page', 'my_edit_per_page', 10, 3 );  // for media library
add_filter( 'get_user_option_edit_media_item_per_page', 'my_edit_per_page', 10, 3 );  // for media library
add_filter( 'get_user_option_edit_media_items_per_page', 'my_edit_per_page', 10, 3 );  // for media library
share|improve this question
up vote 0 down vote accepted

You need upload_per_page:

add_filter( 'get_user_option_edit_upload_per_page', 'my_edit_per_page', 10, 3 );
share|improve this answer
Ah! Thank you. Do you have a reference for how you knew that? My Google searches do not find me any sort of filter listings explaining any of them: get_user_option_edit_page_per_page, get_user_option_edit_post_per_page or get_user_option_edit_upload_per_page – codeview May 7 '14 at 18:54
It's sneakily buried in wp_edit_attachments_query(), which is used by WP_Media_List_Table. But TBH I cheated & just inspected the ID of the screen options field in Firebug ;) – TheDeadMedic May 8 '14 at 17:05
Interesting. Thank you for the response, clarification...and honesty :) – codeview May 8 '14 at 20:47

Setting the value to 999 will screw up most wordpress hosting, I do not know whether it is PHP or Wordpress but I have tried 500 and it completely wrecks that feature. This is particularly true of images in media library, there seems to be a different setting for grid and list, so you still have access to list but if you select grid again you get a white screen of death. Now I have to go in the backend and try and figure out what field in what table holds the setting.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.