From 2fb495eba6eb9754a439c936b86d7a81db358ffd Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Sat, 17 Nov 2012 06:42:14 +0000 Subject: [PATCH] Prevent notices when post_id is not passed to the old media upload forms. props ldebrouwer. fixes #22465. git-svn-id: https://develop.svn.wordpress.org/trunk@22628 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/includes/media.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/wp-admin/includes/media.php b/wp-admin/includes/media.php index 5f590d7099..73c0299501 100644 --- a/wp-admin/includes/media.php +++ b/wp-admin/includes/media.php @@ -1377,7 +1377,8 @@ function get_compat_media_markup( $attachment_id, $args = null ) { * @since 2.5.0 */ function media_upload_header() { - echo '\n"; + $post_id = isset( $_REQUEST['post_id'] ) ? intval( $_REQUEST['post_id'] ) : 0; + echo '\n"; if ( empty( $_GET['chromeless'] ) ) { echo '
'; the_media_upload_tabs(); @@ -1596,7 +1597,7 @@ function media_upload_type_url_form($type = null, $errors = null, $id = null) { media_upload_header(); - $post_id = intval($_REQUEST['post_id']); + $post_id = isset( $_REQUEST['post_id'] ) ? intval( $_REQUEST['post_id'] ) : 0; $form_action_url = admin_url("media-upload.php?type=$type&tab=type&post_id=$post_id"); $form_action_url = apply_filters('media_upload_form_url', $form_action_url, $type); @@ -1871,7 +1872,7 @@ function media_upload_library_form($errors) { media_upload_header(); - $post_id = intval($_REQUEST['post_id']); + $post_id = isset( $_REQUEST['post_id'] ) ? intval( $_REQUEST['post_id'] ) : 0; $form_action_url = admin_url("media-upload.php?type=$type&tab=library&post_id=$post_id"); $form_action_url = apply_filters('media_upload_form_url', $form_action_url, $type);