mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-18 16:45:31 +01:00
Use 'comments_per_page' option as fallback in get_page_of_comment()
.
The function now uses the following order of precedence when calculating comment pagination: 1. the 'per_page' value passed in the `$args` array, 2. the 'comments_per_page' query var in `$wp_query`, and 3. the 'comments_per_page' setting from options-discussion.php. This change allows `get_page_of_comment()` to return an accurate value before the main query has been run. Props laceous. See #13939. Built from https://develop.svn.wordpress.org/trunk@34806 git-svn-id: http://core.svn.wordpress.org/trunk@34771 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
cd5cd380e8
commit
25e7ad64cf
@ -855,8 +855,15 @@ function get_page_of_comment( $comment_ID, $args = array() ) {
|
|||||||
$defaults = array( 'type' => 'all', 'page' => '', 'per_page' => '', 'max_depth' => '' );
|
$defaults = array( 'type' => 'all', 'page' => '', 'per_page' => '', 'max_depth' => '' );
|
||||||
$args = wp_parse_args( $args, $defaults );
|
$args = wp_parse_args( $args, $defaults );
|
||||||
|
|
||||||
if ( '' === $args['per_page'] )
|
// Order of precedence: 1. `$args['per_page']`, 2. 'comments_per_page' query_var, 3. 'comments_per_page' option.
|
||||||
$args['per_page'] = get_query_var('comments_per_page');
|
if ( '' === $args['per_page'] ) {
|
||||||
|
$args['per_page'] = get_query_var( 'comments_per_page' );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( '' === $args['per_page'] ) {
|
||||||
|
$args['per_page'] = get_option( 'comments_per_page' );
|
||||||
|
}
|
||||||
|
|
||||||
if ( empty($args['per_page']) ) {
|
if ( empty($args['per_page']) ) {
|
||||||
$args['per_page'] = 0;
|
$args['per_page'] = 0;
|
||||||
$args['page'] = 0;
|
$args['page'] = 0;
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.4-alpha-34805';
|
$wp_version = '4.4-alpha-34806';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
Loading…
Reference in New Issue
Block a user