mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-12 08:34:35 +00:00
Avoid PHP notices in media modal caused by orphaned attachments.
fixes #29566 for trunk. git-svn-id: https://develop.svn.wordpress.org/trunk@29724 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -2643,6 +2643,11 @@ function wp_prepare_attachment_for_js( $attachment ) {
|
||||
|
||||
if ( $attachment->post_parent ) {
|
||||
$post_parent = get_post( $attachment->post_parent );
|
||||
} else {
|
||||
$post_parent = false;
|
||||
}
|
||||
|
||||
if ( $post_parent ) {
|
||||
$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' );
|
||||
|
||||
Reference in New Issue
Block a user