WordPress.org

Make WordPress Core

Ticket #18604: 18604.diff

File 18604.diff, 1020 bytes (added by lightningspirit, 6 years ago)

New hook for paginate_links() "paginate_links_{$context}". Added $context variable for developers to be able to apply filters for paginate_links() in diferent contextes. Added $context = 'media-upload' for paginate_links() argument for developers to be able to hack the pagination result in the wp-admin/media-upload.php aka Media Library.

  • wp-includes/general-template.php

     
    19881988                $link .= $add_fragment;
    19891989                $page_links[] = '<a class="next page-numbers" href="' . esc_url( apply_filters( 'paginate_links', $link ) ) . '">' . $next_text . '</a>';
    19901990        endif;
     1991       
     1992        $page_links = apply_filters( "paginate_links_{$context}", $page_links );
     1993       
    19911994        switch ( $type ) :
    19921995                case 'array' :
    19931996                        return $page_links;
  • wp-admin/includes/media.php

     
    18611861        'prev_text' => __('&laquo;'),
    18621862        'next_text' => __('&raquo;'),
    18631863        'total' => ceil($wp_query->found_posts / 10),
    1864         'current' => $_GET['paged']
     1864        'current' => $_GET['paged'],
     1865        'context' => 'media-upload'
    18651866));
    18661867
    18671868if ( $page_links )