mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-08 14:44:37 +00:00
Posts, Post Types: Don't force trailing slash in get_pagenum_link().
Previously, a trailing slash was appended to the link returned from `get_pagenum_link()`. If the permalink structure didn't contain a trailing slash, this link could fail. This change removes trailing slashes and only appends one if the site is set for adding trailing slashes. This adds a new test file for the accompanying tests, `tests/phpunit/tests/link/getPagenumLink.php`, and moves an existing test for `get_pagenum_link()` to the same file. Props davemad-davenet, darkfate, Nazgul, scribu, nacin, obenland, chriscct7, jesin, matthewppelsheimer, audrasjb, petitphp, mukesh27, oglekler, mai21, webtechpooja, tejwanihemant, nicolefurlan, hellofromTonya, costdev. Fixes #2877. git-svn-id: https://develop.svn.wordpress.org/trunk@56939 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -4,28 +4,6 @@
|
||||
*/
|
||||
class Tests_Link extends WP_UnitTestCase {
|
||||
|
||||
public function get_pagenum_link_cb( $url ) {
|
||||
return $url . '/WooHoo';
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 8847
|
||||
*/
|
||||
public function test_get_pagenum_link_case_insensitivity() {
|
||||
$old_req_uri = $_SERVER['REQUEST_URI'];
|
||||
|
||||
$this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
|
||||
|
||||
add_filter( 'home_url', array( $this, 'get_pagenum_link_cb' ) );
|
||||
$_SERVER['REQUEST_URI'] = '/woohoo';
|
||||
$paged = get_pagenum_link( 2 );
|
||||
|
||||
remove_filter( 'home_url', array( $this, 'get_pagenum_link_cb' ) );
|
||||
$this->assertSame( $paged, home_url( '/WooHoo/page/2/' ) );
|
||||
|
||||
$_SERVER['REQUEST_URI'] = $old_req_uri;
|
||||
}
|
||||
|
||||
public function test_wp_get_shortlink() {
|
||||
$post_id = self::factory()->post->create();
|
||||
$post_id2 = self::factory()->post->create();
|
||||
|
||||
Reference in New Issue
Block a user