Skip to content

Commit 5da6814

Browse files
committed
Permalinks: Revert [59966].
The original commit ignores some of the arguments that can be passed to the function, mainly `base` and `format`. Reverting for now. Props peterwilsoncc. git-svn-id: https://develop.svn.wordpress.org/trunk@60088 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 6b94186 commit 5da6814

File tree

2 files changed

+0
-79
lines changed

2 files changed

+0
-79
lines changed

src/wp-includes/general-template.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4713,7 +4713,6 @@ function paginate_links( $args = '' ) {
47134713
$link = add_query_arg( $add_args, $link );
47144714
}
47154715
$link .= $args['add_fragment'];
4716-
$link = get_option( 'permalink_structure' ) ? user_trailingslashit( $link, 'paged' ) : $link;
47174716

47184717
$page_links[] = sprintf(
47194718
'<a class="prev page-numbers" href="%s">%s</a>',
@@ -4746,7 +4745,6 @@ function paginate_links( $args = '' ) {
47464745
$link = add_query_arg( $add_args, $link );
47474746
}
47484747
$link .= $args['add_fragment'];
4749-
$link = get_option( 'permalink_structure' ) ? user_trailingslashit( $link, 'paged' ) : $link;
47504748

47514749
$page_links[] = sprintf(
47524750
'<a class="page-numbers" href="%s">%s</a>',
@@ -4771,7 +4769,6 @@ function paginate_links( $args = '' ) {
47714769
$link = add_query_arg( $add_args, $link );
47724770
}
47734771
$link .= $args['add_fragment'];
4774-
$link = get_option( 'permalink_structure' ) ? user_trailingslashit( $link, 'paged' ) : $link;
47754772

47764773
$page_links[] = sprintf(
47774774
'<a class="next page-numbers" href="%s">%s</a>',

tests/phpunit/tests/general/paginateLinks.php

Lines changed: 0 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -362,80 +362,4 @@ public function test_custom_base_query_arg_should_be_stripped_from_current_url_b
362362
$page_2_url = home_url() . '?foo=2';
363363
$this->assertContains( "<a class=\"page-numbers\" href=\"$page_2_url\">2</a>", $links );
364364
}
365-
366-
/**
367-
* @ticket 61393
368-
*/
369-
public function test_pagination_links_with_trailing_slash() {
370-
$this->set_permalink_structure( '/%postname%/' );
371-
372-
$args = array(
373-
'base' => 'http://example.org/category/test/%_%',
374-
'format' => 'page/%#%',
375-
'total' => 5,
376-
'current' => 2,
377-
'prev_next' => true,
378-
);
379-
380-
$links = paginate_links( $args );
381-
382-
// Test page 1 link (should have trailing slash).
383-
$this->assertStringContainsString(
384-
'href="http://example.org/category/test/"',
385-
$links,
386-
'Page 1 link should have trailing slash when permalink structure has trailing slash'
387-
);
388-
389-
// Test page 3 link (should have trailing slash).
390-
$this->assertStringContainsString(
391-
'href="http://example.org/category/test/page/3/"',
392-
$links,
393-
'Page 3 link should have trailing slash when permalink structure has trailing slash'
394-
);
395-
396-
// Test previous link (should have trailing slash).
397-
$this->assertStringContainsString(
398-
'class="prev page-numbers" href="http://example.org/category/test/"',
399-
$links,
400-
'Previous link should have trailing slash when permalink structure has trailing slash'
401-
);
402-
}
403-
404-
/**
405-
* @ticket 61393
406-
*/
407-
public function test_pagination_links_without_trailing_slash() {
408-
$this->set_permalink_structure( '/%postname%' );
409-
410-
$args = array(
411-
'base' => 'http://example.org/category/test/%_%',
412-
'format' => 'page/%#%',
413-
'total' => 5,
414-
'current' => 2,
415-
'prev_next' => true,
416-
);
417-
418-
$links = paginate_links( $args );
419-
420-
// Test page 1 link (should not have trailing slash).
421-
$this->assertStringContainsString(
422-
'href="http://example.org/category/test"',
423-
$links,
424-
'Page 1 link should not have trailing slash when permalink structure has no trailing slash'
425-
);
426-
427-
// Test page 3 link (should not have trailing slash).
428-
$this->assertStringContainsString(
429-
'href="http://example.org/category/test/page/3"',
430-
$links,
431-
'Page 3 link should not have trailing slash when permalink structure has no trailing slash'
432-
);
433-
434-
// Test previous link (should not have trailing slash).
435-
$this->assertStringContainsString(
436-
'class="prev page-numbers" href="http://example.org/category/test"',
437-
$links,
438-
'Previous link should not have trailing slash when permalink structure has no trailing slash'
439-
);
440-
}
441365
}

0 commit comments

Comments
 (0)