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.


Built from https://develop.svn.wordpress.org/trunk@55943


git-svn-id: http://core.svn.wordpress.org/trunk@55455 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Peter Wilson
2023-06-19 23:20:21 +00:00
parent acc6e5d685
commit b5da380334
4 changed files with 39 additions and 3 deletions

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.