Media: Redirect deprecated wp-admin/media.php file.

Redirect users visiting the `wp-admin/media.php` file to the media library, `wp-admin/upload.php`. An user facing warning is displayed when the media library is reached via a deprecated link.

Follow up to [55647].

Props jorbin, audrasjb, azaozz, NekoJonez, kebbet, costdev.
Fixes #57612.



git-svn-id: https://develop.svn.wordpress.org/trunk@55943 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Peter Wilson
2023-06-19 23:18:28 +00:00
parent 75d7208741
commit 6966e31934
3 changed files with 38 additions and 2 deletions
+9 -1
View File
@@ -141,7 +141,15 @@ if ( 'grid' === $mode ) {
wp_enqueue_script( 'media-grid' );
wp_enqueue_script( 'media' );
remove_action( 'admin_head', 'wp_admin_canonical_url' );
// Remove the error parameter added by deprecation of wp-admin/media.php.
add_filter(
'removable_query_args',
function() {
return array( 'error' );
},
10,
0
);
$q = $_GET;
// Let JS handle this.