mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 20:30:23 +00:00
Rewrite: Redirect attachment URLs when their slug changes.
Using the same logic that we use to redirect posts when their slug changes, we can provide the same functionality for attachments. Attachment pages are posts, too. Props swissspdy. Fixes #34043. git-svn-id: https://develop.svn.wordpress.org/trunk@34685 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -121,6 +121,19 @@ class Tests_Rewrite_OldSlugRedirect extends WP_UnitTestCase {
|
||||
wp_old_slug_redirect();
|
||||
$this->assertNull( $this->old_slug_redirect_url );
|
||||
$this->assertQueryTrue( 'is_attachment', 'is_singular', 'is_single' );
|
||||
|
||||
$old_permalink = get_attachment_link( $attachment_id );
|
||||
|
||||
wp_update_post( array(
|
||||
'ID' => $attachment_id,
|
||||
'post_name' => 'the-attachment',
|
||||
) );
|
||||
|
||||
$permalink = user_trailingslashit( trailingslashit( get_permalink( $this->post_id ) ) . 'the-attachment' );
|
||||
|
||||
$this->go_to( $old_permalink );
|
||||
wp_old_slug_redirect();
|
||||
$this->assertEquals( $permalink, $this->old_slug_redirect_url );
|
||||
}
|
||||
|
||||
public function test_old_slug_redirect_paged() {
|
||||
|
||||
Reference in New Issue
Block a user