WordPress.org

Make WordPress Core

Ticket #26869: perpage.diff

File perpage.diff, 1.4 KB (added by Otto42, 4 years ago)

$per_page

  • wp-admin/includes/post.php

     
    949949        elseif ( isset($q['post_status']) && 'pending' == $q['post_status'] )
    950950                $order = 'ASC';
    951951
    952         $per_page = 'edit_' . $post_type . '_per_page';
     952        $per_page = "edit_{$post_type}_per_page";
    953953        $posts_per_page = (int) get_user_option( $per_page );
    954954        if ( empty( $posts_per_page ) || $posts_per_page < 1 )
    955955                $posts_per_page = 20;
     
    957957        /**
    958958         * Filter the number of items per page to show for a specific 'per_page' type.
    959959         *
    960          * The dynamic hook name, $per_page, refers to a hook name comprised of the post type,
    961          * preceded by 'edit_', and succeeded by '_per_page', e.g. 'edit_$post_type_per_page'.
    962          *
    963960         * Some examples of filter hooks generated here include: 'edit_attachment_per_page',
    964961         * 'edit_post_per_page', 'edit_page_per_page', etc.
    965962         *
     
    968965         * @param int $posts_per_page Number of posts to display per page for the given 'per_page'
    969966         *                            type. Default 20.
    970967         */
    971         $posts_per_page = apply_filters( $per_page, $posts_per_page );
     968        $posts_per_page = apply_filters( "edit_{$post_type}_per_page", $posts_per_page );
    972969
    973970        /**
    974971         * Filter the number of posts displayed per page when specifically listing "posts".