From f7c680e84f429448ff018081e83d2771b883f3ff Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Mon, 4 Jul 2016 19:33:43 +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. git-svn-id: https://develop.svn.wordpress.org/trunk@37952 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/class-wp-media-list-table.php | 2 +- src/wp-includes/media.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/wp-admin/includes/class-wp-media-list-table.php b/src/wp-admin/includes/class-wp-media-list-table.php index d2d013d88a..273fe09f7a 100644 --- a/src/wp-admin/includes/class-wp-media-list-table.php +++ b/src/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)' ); } }