[wp-trac] [WordPress Trac] #57612: Deprecate `wp-admin/media.php`
WordPress Trac
noreply at wordpress.org
Wed Apr 12 00:52:52 UTC 2023
#57612: Deprecate `wp-admin/media.php`
-------------------------------+-----------------------------
Reporter: kebbet | Owner: audrasjb
Type: defect (bug) | Status: reopened
Priority: normal | Milestone: 6.3
Component: Media | Version:
Severity: normal | Resolution:
Keywords: early needs-patch | Focuses: administration
-------------------------------+-----------------------------
Comment (by peterwilsoncc):
Completely untested but how about something like the following code.
Unfortunately, `upload.php` removes the `wp_admin_canonical_url` action
from the `admin_init` screen (not sure why) so the `error` would remain in
the URL. It may be possible to reinstate it and use the
`removable_query_args` filter instead. -- This may be a terrible idea, too
:)
{{{#!php
<?php
/**
* Media management action handler.
*
* @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':
// Used in the HTML title tag.
$title = __( 'Edit Media' );
if ( empty( $errors ) ) {
$errors = null;
}
if ( empty( $_GET['attachment_id'] ) ) {
wp_redirect( admin_url( 'upload.php' ) );
exit;
}
$att_id = (int) $_GET['attachment_id'];
wp_redirect( admin_url( "upload.php?item={$att_id}&error
=throw-depreciated-media.php" ) );
exit;
default:
wp_redirect( admin_url( 'upload.php?error=throw-
depreciated-media.php' ) );
exit;
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/57612#comment:20>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list