apply_filters( 'edit_posts_per_page', int $posts_per_page, string $post_type )
- Since
- 2.8.0
Filters the number of posts displayed per page when specifically listing "posts".
Compatibility
- WordPress
- since 2.8.0
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0).
Parameters
$posts_per_pageint- Number of posts to be displayed. Default 20.
$post_typestring- The post type.
Where this hook fires · 3
wp-admin/includes/class-wp-posts-list-table.php:176WP_Posts_List_Table::prepare_items()wp-admin/includes/class-wp-screen.php:1275WP_Screen::render_per_page_options()wp-admin/includes/post.php:1298wp_edit_posts_query()
Source code
* * @since 2.8.0 * * @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 ); $query = compact( 'post_type', 'post_status', 'perm', 'order', 'orderby', 'posts_per_page' ); // Hierarchical types require special args. if ( is_post_type_hierarchical( $post_type ) && empty( $orderby ) ) { $query['orderby'] = 'menu_order title';Changelog
Introduced in 2.8.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 7.1.0 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
- Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.