WordPress.org

Make WordPress Core

Changeset 28958


Ignore:
Timestamp:
07/02/2014 02:10:07 PM (5 years ago)
Author:
SergeyBiryukov
Message:

Canonical redirects should only be applied for GET requests.

props c.axelsson.
fixes #27498.

File:
1 edited

Legend:

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

    r28928 r28958  
    4040    global $wp_rewrite, $is_IIS, $wp_query, $wpdb;
    4141
     42    if ( isset( $_SERVER['REQUEST_METHOD'] ) && 'GET' !== $_SERVER['REQUEST_METHOD'] ) {
     43        return;
     44    }
     45
    4246    // If we're not in wp-admin and the post has been published and preview nonce
    4347    // is non-existent or invalid then no need for preview in query
     
    5054    }
    5155
    52     if ( is_trackback() || is_search() || is_comments_popup() || is_admin() || !empty($_POST) || is_preview() || is_robots() || ( $is_IIS && !iis7_supports_permalinks() ) )
     56    if ( is_trackback() || is_search() || is_comments_popup() || is_admin() || is_preview() || is_robots() || ( $is_IIS && !iis7_supports_permalinks() ) ) {
    5357        return;
     58    }
    5459
    5560    if ( !$requested_url ) {
Note: See TracChangeset for help on using the changeset viewer.