The edit_{$post_type}_per_page WordPress PHP filter allows you to change the number of items displayed per page for a specific post type in the admin area.
Usage
add_filter('edit_post_per_page', 'your_function_name'); function your_function_name($posts_per_page) { // your custom code here return $posts_per_page; }
Parameters
$posts_per_page
(int): Number of posts to display per page for the given post type. Default is 20.
More information
See WordPress Developer Resources: edit_{$post_type}_per_page
Examples
Change number of posts per page in admin
Change the number of posts displayed per page in the admin area to 50:
add_filter('edit_post_per_page', 'change_posts_per_page'); function change_posts_per_page($posts_per_page) { $posts_per_page = 50; return $posts_per_page; }
Change number of pages per page in admin
Change the number of pages displayed per page in the admin area to 30:
add_filter('edit_page_per_page', 'change_pages_per_page'); function change_pages_per_page($posts_per_page) { $posts_per_page = 30; return $posts_per_page; }
Change number of attachments per page in admin
Change the number of attachments displayed per page in the admin area to 40:
add_filter('edit_attachment_per_page', 'change_attachments_per_page'); function change_attachments_per_page($posts_per_page) { $posts_per_page = 40; return $posts_per_page; }
Change number of custom post type items per page in admin
Change the number of items displayed per page for a custom post type called “portfolio” in the admin area to 25:
add_filter('edit_portfolio_per_page', 'change_portfolio_items_per_page'); function change_portfolio_items_per_page($posts_per_page) { $posts_per_page = 25; return $posts_per_page; }
Conditionally change number of items per page in admin
Change the number of items displayed per page in the admin area to 10 for users with a specific capability:
add_filter('edit_post_per_page', 'conditionally_change_items_per_page'); function conditionally_change_items_per_page($posts_per_page) { if (current_user_can('edit_others_posts')) { $posts_per_page = 10; } return $posts_per_page; }