Make WordPress Core


Ignore:
Timestamp:
09/29/2015 04:57:02 AM (9 years ago)
Author:
pento
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/default-filters.php

    r34561 r34685  
    295295
    296296// Redirect Old Slugs
    297 add_action( 'template_redirect', 'wp_old_slug_redirect'              );
    298 add_action( 'post_updated',      'wp_check_for_changed_slugs', 12, 3 );
     297add_action( 'template_redirect',  'wp_old_slug_redirect'              );
     298add_action( 'post_updated',       'wp_check_for_changed_slugs', 12, 3 );
     299add_action( 'attachment_updated', 'wp_check_for_changed_slugs', 12, 3 );
    299300
    300301// Nonce check for Post Previews
Note: See TracChangeset for help on using the changeset viewer.