Make WordPress Core


Ignore:
Timestamp:
01/24/2018 07:11:40 AM (8 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.

Merge of [42401,42587,42588] to the 4.9 branch.

Props nickmomrik, frank-klein.
Fixes #15397.

Location:
branches/4.9
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.9

  • branches/4.9/src/wp-includes/default-filters.php

    r42445 r42589  
    343343add_action( 'attachment_updated', 'wp_check_for_changed_slugs', 12, 3 );
    344344
     345// Redirect Old Dates
     346add_action( 'post_updated',       'wp_check_for_changed_dates', 12, 3 );
     347add_action( 'attachment_updated', 'wp_check_for_changed_dates', 12, 3 );
     348
    345349// Nonce check for Post Previews
    346350add_action( 'init', '_show_post_preview' );
Note: See TracChangeset for help on using the changeset viewer.