diff --git a/src/wp-includes/canonical.php b/src/wp-includes/canonical.php index b9547d824b..a4a56ec445 100644 --- a/src/wp-includes/canonical.php +++ b/src/wp-includes/canonical.php @@ -39,6 +39,10 @@ function redirect_canonical( $requested_url = null, $do_redirect = true ) { global $wp_rewrite, $is_IIS, $wp_query, $wpdb; + if ( isset( $_SERVER['REQUEST_METHOD'] ) && 'GET' !== $_SERVER['REQUEST_METHOD'] ) { + return; + } + // If we're not in wp-admin and the post has been published and preview nonce // is non-existent or invalid then no need for preview in query if ( is_preview() && get_query_var( 'p' ) && 'publish' == get_post_status( get_query_var( 'p' ) ) ) { @@ -49,8 +53,9 @@ function redirect_canonical( $requested_url = null, $do_redirect = true ) { } } - if ( is_trackback() || is_search() || is_comments_popup() || is_admin() || !empty($_POST) || is_preview() || is_robots() || ( $is_IIS && !iis7_supports_permalinks() ) ) + if ( is_trackback() || is_search() || is_comments_popup() || is_admin() || is_preview() || is_robots() || ( $is_IIS && !iis7_supports_permalinks() ) ) { return; + } if ( !$requested_url ) { // build the URL in the address bar