WordPress/wp-admin/media.php
Peter Wilson b5da380334 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
2023-06-19 23:20:21 +00:00

36 lines
763 B
PHP

<?php
/**
* Media management action handler.
*
* This file is deprecated, use 'wp-admin/upload.php' instead.
*
* @deprecated 6.3.0
* @package WordPress
* @subpackage Administration
*/
/** Load WordPress Administration Bootstrap. */
require_once __DIR__ . '/admin.php';
$parent_file = 'upload.php';
$submenu_file = 'upload.php';
wp_reset_vars( array( 'action' ) );
switch ( $action ) {
case 'editattachment':
case 'edit':
if ( empty( $_GET['attachment_id'] ) ) {
wp_redirect( admin_url( 'upload.php?error=deprecated' ) );
exit;
}
$att_id = (int) $_GET['attachment_id'];
wp_redirect( admin_url( "upload.php?item={$att_id}&error=deprecated" ) );
exit;
default:
wp_redirect( admin_url( 'upload.php?error=deprecated' ) );
exit;
}