Make WordPress Core


Ignore:
Timestamp:
03/23/2016 09:53:44 PM (9 years ago)
Author:
SergeyBiryukov
Message:

Canonical / Query: Restore the is_404() check in wp_old_slug_redirect() which was removed in [34659].
This reverts part of [34659] due to excessive canonical problems it's caused in 4.4.x.

Remove the unit tests which are no longer supported.
This also removes the is_feed() code to avoid confusion - only pages & embeds will be redirected.

Merges [36280] and [36281] to trunk.

Props dd32.
See #21602, #35344.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/rewrite/oldSlugRedirect.php

    r36128 r37075  
    4545
    4646        $permalink = user_trailingslashit( get_permalink( $this->post_id ) );
    47 
    48         $this->go_to( $old_permalink );
    49         wp_old_slug_redirect();
    50         $this->assertEquals( $permalink, $this->old_slug_redirect_url );
    51     }
    52 
    53     public function test_old_slug_redirect_endpoint() {
    54         $old_permalink = user_trailingslashit( trailingslashit( get_permalink( $this->post_id ) ) . 'custom-endpoint' );
    55 
    56         wp_update_post( array(
    57             'ID' => $this->post_id,
    58             'post_name' => 'bar-baz',
    59         ) );
    60 
    61         $permalink = user_trailingslashit( trailingslashit( get_permalink( $this->post_id ) ) . 'custom-endpoint' );
    62 
    63         $this->go_to( $old_permalink );
    64         $GLOBALS['wp_query']->query_vars['custom-endpoint'] = true;
    65         wp_old_slug_redirect();
    66         $this->assertEquals( $permalink, $this->old_slug_redirect_url );
    67     }
    68 
    69     public function test_old_slug_redirect_endpoint_custom_query_var() {
    70         $old_permalink = user_trailingslashit( trailingslashit( get_permalink( $this->post_id ) ) . 'second-endpoint' );
    71 
    72         wp_update_post( array(
    73             'ID' => $this->post_id,
    74             'post_name' => 'bar-baz',
    75         ) );
    76 
    77         $permalink = user_trailingslashit( trailingslashit( get_permalink( $this->post_id ) ) . 'second-endpoint' );
    78 
    79         $this->go_to( $old_permalink );
    80         $GLOBALS['wp_query']->query_vars['custom'] = true;
    81         wp_old_slug_redirect();
    82         $this->assertEquals( $permalink, $this->old_slug_redirect_url );
    83     }
    84 
    85     public function test_old_slug_redirect_feed() {
    86         $old_permalink = user_trailingslashit( trailingslashit( get_permalink( $this->post_id ) ) . 'feed' );
    87 
    88         wp_update_post( array(
    89             'ID' => $this->post_id,
    90             'post_name' => 'bar-baz',
    91         ) );
    92 
    93         $permalink = user_trailingslashit( trailingslashit( get_permalink( $this->post_id ) ) . 'feed' );
    9447
    9548        $this->go_to( $old_permalink );
Note: See TracChangeset for help on using the changeset viewer.