From e64b88cb3487ebefecc54b4f435b8c5241671a28 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Mon, 4 Jul 2016 19:34:28 +0000 Subject: [PATCH] Media: Avoid PHP notices when trying to show a parent post title of an orphaned post type. Props littler.chicken. See #37186. Built from https://develop.svn.wordpress.org/trunk@37952 git-svn-id: http://core.svn.wordpress.org/trunk@37893 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/class-wp-media-list-table.php | 2 +- wp-includes/media.php | 3 ++- wp-includes/version.php | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/wp-admin/includes/class-wp-media-list-table.php b/wp-admin/includes/class-wp-media-list-table.php index d2d013d88a..273fe09f7a 100644 --- a/wp-admin/includes/class-wp-media-list-table.php +++ b/wp-admin/includes/class-wp-media-list-table.php @@ -481,7 +481,7 @@ class WP_Media_List_Table extends WP_List_Table { ?> post_parent ) ) { + } elseif ( $parent_type && current_user_can( 'read_post', $post->post_parent ) ) { ?> post_type ); + if ( $parent_type && $parent_type->show_ui && current_user_can( 'edit_post', $attachment->post_parent ) ) { $response['uploadedToLink'] = get_edit_post_link( $attachment->post_parent, 'raw' ); } - if ( current_user_can( 'read_post', $attachment->post_parent ) ) { + if ( $parent_type && current_user_can( 'read_post', $attachment->post_parent ) ) { $response['uploadedToTitle'] = $post_parent->post_title ? $post_parent->post_title : __( '(no title)' ); } } diff --git a/wp-includes/version.php b/wp-includes/version.php index 832e86482a..7cdee33b69 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.6-beta1-37951'; +$wp_version = '4.6-beta1-37952'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.