mirror of
git://develop.git.wordpress.org/
synced 2025-01-17 12:58:25 +01:00
Canonical / Query: After [36280] remove the unit tests which are no longer supported for 4.4.
This also removes the `is_feed()` code to avoid confusion - only pages & embeds will be redirected. See #35344 git-svn-id: https://develop.svn.wordpress.org/branches/4.4@36281 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
bbbf6eab8a
commit
d84b9f21f6
@ -5027,9 +5027,7 @@ function wp_old_slug_redirect() {
|
||||
|
||||
$link = get_permalink( $id );
|
||||
|
||||
if ( is_feed() ) {
|
||||
$link = user_trailingslashit( trailingslashit( $link ) . 'feed' );
|
||||
} elseif ( isset( $GLOBALS['wp_query']->query_vars['paged'] ) && $GLOBALS['wp_query']->query_vars['paged'] > 1 ) {
|
||||
if ( isset( $GLOBALS['wp_query']->query_vars['paged'] ) && $GLOBALS['wp_query']->query_vars['paged'] > 1 ) {
|
||||
$link = user_trailingslashit( trailingslashit( $link ) . 'page/' . $GLOBALS['wp_query']->query_vars['paged'] );
|
||||
} elseif( is_embed() ) {
|
||||
$link = user_trailingslashit( trailingslashit( $link ) . 'embed' );
|
||||
|
@ -50,53 +50,6 @@ class Tests_Rewrite_OldSlugRedirect extends WP_UnitTestCase {
|
||||
$this->assertEquals( $permalink, $this->old_slug_redirect_url );
|
||||
}
|
||||
|
||||
public function test_old_slug_redirect_endpoint() {
|
||||
$old_permalink = user_trailingslashit( trailingslashit( get_permalink( $this->post_id ) ) . 'custom-endpoint' );
|
||||
|
||||
wp_update_post( array(
|
||||
'ID' => $this->post_id,
|
||||
'post_name' => 'bar-baz',
|
||||
) );
|
||||
|
||||
$permalink = user_trailingslashit( trailingslashit( get_permalink( $this->post_id ) ) . 'custom-endpoint' );
|
||||
|
||||
$this->go_to( $old_permalink );
|
||||
$GLOBALS['wp_query']->query_vars['custom-endpoint'] = true;
|
||||
wp_old_slug_redirect();
|
||||
$this->assertEquals( $permalink, $this->old_slug_redirect_url );
|
||||
}
|
||||
|
||||
public function test_old_slug_redirect_endpoint_custom_query_var() {
|
||||
$old_permalink = user_trailingslashit( trailingslashit( get_permalink( $this->post_id ) ) . 'second-endpoint' );
|
||||
|
||||
wp_update_post( array(
|
||||
'ID' => $this->post_id,
|
||||
'post_name' => 'bar-baz',
|
||||
) );
|
||||
|
||||
$permalink = user_trailingslashit( trailingslashit( get_permalink( $this->post_id ) ) . 'second-endpoint' );
|
||||
|
||||
$this->go_to( $old_permalink );
|
||||
$GLOBALS['wp_query']->query_vars['custom'] = true;
|
||||
wp_old_slug_redirect();
|
||||
$this->assertEquals( $permalink, $this->old_slug_redirect_url );
|
||||
}
|
||||
|
||||
public function test_old_slug_redirect_feed() {
|
||||
$old_permalink = user_trailingslashit( trailingslashit( get_permalink( $this->post_id ) ) . 'feed' );
|
||||
|
||||
wp_update_post( array(
|
||||
'ID' => $this->post_id,
|
||||
'post_name' => 'bar-baz',
|
||||
) );
|
||||
|
||||
$permalink = user_trailingslashit( trailingslashit( get_permalink( $this->post_id ) ) . 'feed' );
|
||||
|
||||
$this->go_to( $old_permalink );
|
||||
wp_old_slug_redirect();
|
||||
$this->assertEquals( $permalink, $this->old_slug_redirect_url );
|
||||
}
|
||||
|
||||
public function test_old_slug_redirect_attachment() {
|
||||
$file = DIR_TESTDATA . '/images/canola.jpg';
|
||||
$attachment_id = self::factory()->attachment->create_object( $file, $this->post_id, array(
|
||||
|
Loading…
x
Reference in New Issue
Block a user