Centralize pagination bound exceeding redirects for list tables. props garyc40. props johnjamesjacoby. fixes #16208

git-svn-id: https://develop.svn.wordpress.org/trunk@17900 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Mark Jaquith
2011-05-12 06:09:42 +00:00
parent c96930408d
commit 4f8b646e03
9 changed files with 6 additions and 46 deletions

View File

@@ -139,6 +139,12 @@ class WP_List_Table {
if ( !$args['total_pages'] && $args['per_page'] > 0 )
$args['total_pages'] = ceil( $args['total_items'] / $args['per_page'] );
// redirect if page number is invalid and headers are not already sent
if ( ! headers_sent() && ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) && $args['total_pages'] > 0 && $this->get_pagenum() > $args['total_pages'] ) {
wp_redirect( add_query_arg( 'paged', $args['total_pages'] ) );
exit;
}
$this->_pagination_args = $args;
}