mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-22 23:41:38 +01:00
Avoid PHP notices in Media Library if an attachment parent does not exist. props trepmal, viniciusmassuchetto, alex-ye, adamsilverstein for initial patches. fixes #22312. fixes #23154.
git-svn-id: http://core.svn.wordpress.org/trunk@24182 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
d55dfbf477
commit
23479edf3f
@ -302,10 +302,8 @@ foreach ( $columns as $column_name => $column_display_name ) {
|
||||
break;
|
||||
|
||||
case 'parent':
|
||||
if ( $post->post_parent > 0 ) {
|
||||
if ( get_post( $post->post_parent ) ) {
|
||||
if ( $post->post_parent > 0 && get_post( $post->post_parent ) ) {
|
||||
$title = _draft_or_post_title( $post->post_parent );
|
||||
}
|
||||
?>
|
||||
<td <?php echo $attributes ?>><strong>
|
||||
<?php if ( current_user_can( 'edit_post', $post->post_parent ) ) { ?>
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user