diff --git src/wp-includes/general-template.php src/wp-includes/general-template.php
index 6f0ff15..d393197 100644
|
|
function paginate_links( $args = '' ) { |
2619 | 2619 | |
2620 | 2620 | $args = wp_parse_args( $args, $defaults ); |
2621 | 2621 | |
| 2622 | if ( ! is_array( $args['add_args'] ) ) { |
| 2623 | $args['add_args'] = array(); |
| 2624 | } |
| 2625 | |
2622 | 2626 | // Merge additional query vars found in the original URL into 'add_args' array. |
2623 | 2627 | if ( isset( $url_parts[1] ) ) { |
2624 | 2628 | // Find the format argument. |
… |
… |
function paginate_links( $args = '' ) { |
2644 | 2648 | if ( $mid_size < 0 ) { |
2645 | 2649 | $mid_size = 2; |
2646 | 2650 | } |
2647 | | $add_args = is_array( $args['add_args'] ) ? $args['add_args'] : false; |
| 2651 | $add_args = ! empty( $args['add_args'] ) ? $args['add_args'] : false; |
2648 | 2652 | $r = ''; |
2649 | 2653 | $page_links = array(); |
2650 | 2654 | $dots = false; |
diff --git tests/phpunit/tests/general/paginateLinks.php tests/phpunit/tests/general/paginateLinks.php
index 930dcde..b6c1a32 100644
|
|
EXPECTED; |
291 | 291 | |
292 | 292 | $_SERVER['REQUEST_URI'] = $request_uri; |
293 | 293 | } |
| 294 | |
| 295 | /** |
| 296 | * @ticket 30831 |
| 297 | */ |
| 298 | public function test_paginate_links_should_allow_add_args_to_be_bool_false() { |
| 299 | // Fake the query params. |
| 300 | $request_uri = $_SERVER['REQUEST_URI']; |
| 301 | $_SERVER['REQUEST_URI'] = add_query_arg( 'foo', 3, home_url() ); |
| 302 | |
| 303 | $links = paginate_links( array( |
| 304 | 'add_args' => false, |
| 305 | 'base' => add_query_arg( 'foo', '%#%' ), |
| 306 | 'format' => '', |
| 307 | 'total' => 5, |
| 308 | 'current' => 3, |
| 309 | 'type' => 'array', |
| 310 | ) ); |
| 311 | |
| 312 | $this->assertContains( "<span class='page-numbers current'>3</span>", $links ); |
| 313 | } |
294 | 314 | } |