diff --git a/wp-admin/includes/class-wp-media-list-table.php b/wp-admin/includes/class-wp-media-list-table.php index cb633d1c86..c3b5faade0 100644 --- a/wp-admin/includes/class-wp-media-list-table.php +++ b/wp-admin/includes/class-wp-media-list-table.php @@ -302,13 +302,11 @@ foreach ( $columns as $column_name => $column_display_name ) { break; case 'parent': - if ( $post->post_parent > 0 ) { - if ( get_post( $post->post_parent ) ) { - $title =_draft_or_post_title( $post->post_parent ); - } + if ( $post->post_parent > 0 && get_post( $post->post_parent ) ) { + $title = _draft_or_post_title( $post->post_parent ); ?> > - post_parent ) ) { ?> + post_parent ) ) { ?> $column_display_name ) { } else { ?> >
- + diff --git a/wp-includes/link-template.php b/wp-includes/link-template.php index 1daf48779c..755c6a1f61 100644 --- a/wp-includes/link-template.php +++ b/wp-includes/link-template.php @@ -301,9 +301,9 @@ function get_attachment_link( $post = null, $leavename = false ) { $link = false; $post = get_post( $post ); + $parent = ( $post->post_parent > 0 && $post->post_parent != $post->ID ) ? get_post( $post->post_parent ) : false; - if ( $wp_rewrite->using_permalinks() && ( $post->post_parent > 0 ) && ( $post->post_parent != $post->ID ) ) { - $parent = get_post($post->post_parent); + if ( $wp_rewrite->using_permalinks() && $parent ) { if ( 'page' == $parent->post_type ) $parentlink = _get_page_link( $post->post_parent ); // Ignores page_on_front else