WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#14800 closed defect (bug) (duplicate)

'edit_posts_per_page' filter missing in 'wp-admin/includes/template.php'

Reported by: sorich87 Owned by: sorich87
Milestone: Priority: normal
Severity: normal Version: 3.0.1
Component: Administration Keywords: has-patch
Focuses: Cc:

Description

When I modify the default number of posts, e.g. to 30 posts per page, in the posts list with the following code, the number of posts per line is set to 30, but the screen option remains 20.

function my_edit_post_per_page( $per_page, $post_type ) {

if( !get_user_option( 'edit_' . $post_type . '_per_page' ) ) { if the current user did not customize the setting

$per_page = 30; set the number of rows in the table

}
return $per_page;

}

add_filter( 'edit_posts_per_page', 'my_edit_post_per_page' );

The bug, does not occur when I use a post type specific filter 'edit_post_per_page' or 'edit_page_per_page' e.g., instead of the global filter 'edit_post_per_page'.

The attached patch fixes the issue.

Attachments (1)

14800.diff (654 bytes) - added by sorich87 4 years ago.

Download all attachments as: .zip

Change History (4)

sorich874 years ago

comment:1 nacin4 years ago

Can you take a look at #14135? There is likely some crossover.

comment:2 sorich874 years ago

  • Resolution set to duplicate
  • Status changed from new to closed

WOW!!! You are fast nacin!

I will close this ticket and submit my patch there.

comment:3 scribu4 years ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.