mirror of
https://github.com/WordPress/WordPress.git
synced 2024-06-26 14:54:57 +02:00
Use an interpolated hook name for edit_{$post_type}_per_page
instead of $per_page
and adjust docs accordingly.
Also references the correct variable for the `$posts_per_page` parameter in the `edit_posts_per_page` hook doc. Props Otto42 for the initial patch. See #26869. Built from https://develop.svn.wordpress.org/trunk@28347 git-svn-id: http://core.svn.wordpress.org/trunk@28175 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
1daa7d6723
commit
8906f83802
|
@ -949,7 +949,7 @@ function wp_edit_posts_query( $q = false ) {
|
|||
elseif ( isset($q['post_status']) && 'pending' == $q['post_status'] )
|
||||
$order = 'ASC';
|
||||
|
||||
$per_page = 'edit_' . $post_type . '_per_page';
|
||||
$per_page = "edit_{$post_type}_per_page";
|
||||
$posts_per_page = (int) get_user_option( $per_page );
|
||||
if ( empty( $posts_per_page ) || $posts_per_page < 1 )
|
||||
$posts_per_page = 20;
|
||||
|
@ -957,26 +957,25 @@ function wp_edit_posts_query( $q = false ) {
|
|||
/**
|
||||
* Filter the number of items per page to show for a specific 'per_page' type.
|
||||
*
|
||||
* The dynamic hook name, $per_page, refers to a hook name comprised of the post type,
|
||||
* preceded by 'edit_', and succeeded by '_per_page', e.g. 'edit_$post_type_per_page'.
|
||||
* The dynamic portion of the hook name, $post_type, refers to the post type.
|
||||
*
|
||||
* Some examples of filter hooks generated here include: 'edit_attachment_per_page',
|
||||
* 'edit_post_per_page', 'edit_page_per_page', etc.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param int $posts_per_page Number of posts to display per page for the given 'per_page'
|
||||
* @param int $posts_per_page Number of posts to display per page for the given post
|
||||
* type. Default 20.
|
||||
*/
|
||||
$posts_per_page = apply_filters( $per_page, $posts_per_page );
|
||||
$posts_per_page = apply_filters( "edit_{$post_type}_per_page", $posts_per_page );
|
||||
|
||||
/**
|
||||
* Filter the number of posts displayed per page when specifically listing "posts".
|
||||
*
|
||||
* @since 2.8.0
|
||||
*
|
||||
* @param int $per_page Number of posts to be displayed. Default 20.
|
||||
* @param string $post_type The post type.
|
||||
* @param int $posts_per_page Number of posts to be displayed. Default 20.
|
||||
* @param string $post_type The post type.
|
||||
*/
|
||||
$posts_per_page = apply_filters( 'edit_posts_per_page', $posts_per_page, $post_type );
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user