Changeset 34806
- Timestamp:
- 10/03/2015 07:25:25 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/comment-functions.php
r34805 r34806 856 856 $args = wp_parse_args( $args, $defaults ); 857 857 858 if ( '' === $args['per_page'] ) 859 $args['per_page'] = get_query_var('comments_per_page'); 858 // Order of precedence: 1. `$args['per_page']`, 2. 'comments_per_page' query_var, 3. 'comments_per_page' option. 859 if ( '' === $args['per_page'] ) { 860 $args['per_page'] = get_query_var( 'comments_per_page' ); 861 } 862 863 if ( '' === $args['per_page'] ) { 864 $args['per_page'] = get_option( 'comments_per_page' ); 865 } 866 860 867 if ( empty($args['per_page']) ) { 861 868 $args['per_page'] = 0; -
trunk/tests/phpunit/tests/comment/getPageOfComment.php
r34805 r34806 227 227 } 228 228 } 229 230 /** 231 * @ticket 13939 232 */ 233 public function test_comments_per_page_option_should_be_fallback_when_query_var_is_not_available() { 234 $now = time(); 235 236 $p = $this->factory->post->create(); 237 $c1 = $this->factory->comment->create( array( 'comment_post_ID' => $p, 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now ) ) ); 238 $c2 = $this->factory->comment->create( array( 'comment_post_ID' => $p, 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 20 ) ) ); 239 $c3 = $this->factory->comment->create( array( 'comment_post_ID' => $p, 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 30 ) ) ); 240 241 update_option( 'comments_per_page', 2 ); 242 243 $this->assertEquals( 2, get_page_of_comment( $c1 ) ); 244 } 229 245 }
Note: See TracChangeset
for help on using the changeset viewer.