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'm trying to add more rows in the media picker modal window. Is there any clean way to achieve doing this ?

Thanks !

share|improve this question
You can upload multiple files by ctrl+click. Does that resolve your issue? – GavinR Nov 16 '11 at 1:30
Thanks but it's not the point ;) I want to be able to visualize more than 10 uploaded images by page. – Kaaviar Nov 16 '11 at 23:44
up vote 2 down vote accepted

my plugin: http://wordpress.org/extend/plugins/mediapicker-more-rows/

I found a way to fix the pagination

There is a way you can 'hook' into paginate_links. There is no official hook for it, but you can change the $wp_query->found_posts variable.

What I did here is 'hooking' into the paginate_links by abusing the media_upload_mime_type_links filter and setting a new value for $wp_query->found_posts.

This filter is triggered just before paginate_links is called.

function set_paginate_limit_mediapicker( $type_links )
    global $wp_query;       

    $new_limit = 30; // set your limit
    $wp_query->found_posts = $wp_query->found_posts / ( $new_limit / 10 );

    return $type_links; // not used 
add_filter( 'media_upload_mime_type_links', 'set_paginate_limit_mediapicker', 1 );

I have made a WordPress plugin for the complete solution, which you will find in the repository.


share|improve this answer
Amazing, tschutter! Pity is that I did put a bounty of 100 points on this question that ended some days ago... – brasofilo Jun 25 '12 at 17:10
That's ok, glad I could be of help! – tschutter Jun 26 '12 at 7:36

This works but the big issue is to solve the pagination, because it is completely broken.


function wpse_33775_add_rows_to_media_library($limits)
    global $current_screen;
    $tab = isset( $_GET['tab'] ) ? $_GET['tab'] : "type";

    if( 'media-upload' != $current_screen->id && 'library' != $tab )
        return $limits;

    $my_new_limit = '100';
    $limits = str_replace('10',$my_new_limit,$limits); // replacing the default 10

    return $limits;

Is there a way to hook here?

 * WordPress 3.3.2
 * /wp-admin/includes/media.php
 * line 1828
$page_links = paginate_links( array(
    'base' => add_query_arg( 'paged', '%#%' ),
    'format' => '',
    'prev_text' => __('«'),
    'next_text' => __('»'),
    'total' => ceil($wp_query->found_posts / 10),
    'current' => $_GET['paged']

if ( $page_links )
    echo "<div class='tablenav-pages'>$page_links</div>";
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.