diff --git a/src/wp-admin/includes/class-wp-screen.php b/src/wp-admin/includes/class-wp-screen.php index de65c86a2f..b92ad5c7be 100644 --- a/src/wp-admin/includes/class-wp-screen.php +++ b/src/wp-admin/includes/class-wp-screen.php @@ -308,6 +308,9 @@ final class WP_Screen { if ( null === $post_type && is_object_in_taxonomy( 'post', $taxonomy ? $taxonomy : 'post_tag' ) ) $post_type = 'post'; break; + case 'upload': + $post_type = 'attachment'; + break; } } diff --git a/tests/phpunit/tests/admin/includesScreen.php b/tests/phpunit/tests/admin/includesScreen.php index f60e0b8f8b..c721135f87 100644 --- a/tests/phpunit/tests/admin/includesScreen.php +++ b/tests/phpunit/tests/admin/includesScreen.php @@ -12,7 +12,7 @@ class Tests_Admin_includesScreen extends WP_UnitTestCase { 'edit-tags.php' => array( 'base' => 'edit-tags', 'id' => 'edit-post_tag', 'post_type' => 'post', 'taxonomy' => 'post_tag' ), 'edit-tags.php?taxonomy=post_tag' => array( 'base' => 'edit-tags', 'id' => 'edit-post_tag', 'post_type' => 'post', 'taxonomy' => 'post_tag' ), 'edit-tags.php?taxonomy=category' => array( 'base' => 'edit-tags', 'id' => 'edit-category', 'post_type' => 'post', 'taxonomy' => 'category' ), - 'upload.php' => array( 'base' => 'upload', 'id' => 'upload' ), + 'upload.php' => array( 'base' => 'upload', 'id' => 'upload', 'post_type' => 'attachment' ), 'media-new.php' => array( 'action' => 'add', 'base' => 'media', 'id' => 'media' ), 'edit.php?post_type=page' => array( 'base' => 'edit', 'id' => 'edit-page', 'post_type' => 'page' ), 'link-manager.php' => array( 'base' => 'link-manager', 'id' => 'link-manager' ),