From b5904b9525a891ab63ae8b2c1b05ee539ed7ac0d Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Wed, 9 May 2012 16:16:03 +0000 Subject: [PATCH] Restrict the media editor to posts with the attachment post type. Props helenyhou. fixes #20625 git-svn-id: https://develop.svn.wordpress.org/trunk@20753 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/media.php | 1 + 1 file changed, 1 insertion(+) diff --git a/wp-admin/media.php b/wp-admin/media.php index 5381865c2a..15d4323876 100644 --- a/wp-admin/media.php +++ b/wp-admin/media.php @@ -59,6 +59,7 @@ case 'edit' : $att = get_post($att_id); if ( empty($att->ID) ) wp_die( __('You attempted to edit an attachment that doesn’t exist. Perhaps it was deleted?') ); + if ( 'attachment' !== $att->post_type ) wp_die( __('You attempted to edit an item that isn’t an attachment. Please go back and try again.') ); if ( $att->post_status == 'trash' ) wp_die( __('You can’t edit this attachment because it is in the Trash. Please move it out of the Trash and try again.') ); add_filter('attachment_fields_to_edit', 'media_single_attachment_fields_to_edit', 10, 2);