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 4104f24c47..91c72c71b1 100644 --- a/src/wp-admin/includes/class-wp-media-list-table.php +++ b/src/wp-admin/includes/class-wp-media-list-table.php @@ -370,7 +370,7 @@ foreach ( $columns as $column_name => $column_display_name ) { $parent_type = get_post_type_object( $parent->post_type ); ?> > - post_parent ) && $parent_type && $parent_type->show_ui ) { ?> + show_ui && current_user_can( 'edit_post', $post->post_parent ) ) { ?> <# } #>
diff --git a/src/wp-includes/media.php b/src/wp-includes/media.php index b4f24e6cf0..bf663b2335 100644 --- a/src/wp-includes/media.php +++ b/src/wp-includes/media.php @@ -2636,7 +2636,10 @@ function wp_prepare_attachment_for_js( $attachment ) { if ( $attachment->post_parent ) { $post_parent = get_post( $attachment->post_parent ); - $response['uploadedToLink'] = get_edit_post_link( $attachment->post_parent, 'raw' ); + $parent_type = get_post_type_object( $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' ); + } $response['uploadedToTitle'] = $post_parent->post_title ? $post_parent->post_title : __( '(No title)' ); }