WordPress.org

Make WordPress Core


Ignore:
Timestamp:
12/15/2017 08:30:50 AM (2 years ago)
Author:
pento
Message:

Canonical URLs: Redirect to the correct URL when the post date changes.

When a post slug is changed, we store a copy of the old slug, so that we can redirect visitors visiting the old URL to the new URL.

In the same way, this stores a copy of the old date, when the post date changes, so we can redirect visitors to the new URL.

Props nickmomrik.
Fixes #15397 for trunk.

File:
1 edited

Legend:

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

    r42343 r42401  
    355355add_action( 'attachment_updated', 'wp_check_for_changed_slugs', 12, 3 );
    356356
     357// Redirect Old Dates
     358add_action( 'post_updated',       'wp_check_for_changed_dates', 12, 3 );
     359add_action( 'attachment_updated', 'wp_check_for_changed_dates', 12, 3 );
     360
    357361// Nonce check for Post Previews
    358362add_action( 'init', '_show_post_preview' );
Note: See TracChangeset for help on using the changeset viewer.