Skip to content

Commit

Permalink
WordPress 6.4 improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
joppuyo committed Nov 8, 2023
1 parent 2b6a487 commit a56970e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@ function redirect_canonical($redirect_url, $requested_url)
global $wp_query;
$wp_query->set_404();
status_header(404);

// Handle WordPress 6.4's attachment page redirection by cancelling the redirection.
// https://make.wordpress.org/core/2023/10/16/changes-to-attachment-pages/
global $wp_version;
if (version_compare($wp_version, '6.4', '>=')) {
return false;
}

}
return $redirect_url;
}
Expand Down

0 comments on commit a56970e

Please sign in to comment.