From 7bf64e01259ce51318bf0622db9f382056609c4d Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Thu, 10 Sep 2015 20:50:12 +0000 Subject: [PATCH] Comments/PHP Notices: check that a parent comment exists before displaying an orphan's link to it in the admin. Props rachelbaker. Fixes #33710. git-svn-id: https://develop.svn.wordpress.org/trunk@34015 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/edit-form-comment.php | 24 ++++++++++--------- .../includes/class-wp-comments-list-table.php | 8 ++++--- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/src/wp-admin/edit-form-comment.php b/src/wp-admin/edit-form-comment.php index d63420e106..dda2615134 100644 --- a/src/wp-admin/edit-form-comment.php +++ b/src/wp-admin/edit-form-comment.php @@ -119,17 +119,19 @@ if ( current_user_can( 'edit_post', $post_id ) ) { comment_parent ) : $parent = get_comment( $comment->comment_parent ); - $parent_link = esc_url( get_comment_link( $comment->comment_parent ) ); - $name = get_comment_author( $parent->comment_ID ); -?> -
- ' . $name . '' - ); ?> -
- + if ( $parent ) : + $parent_link = esc_url( get_comment_link( $comment->comment_parent ) ); + $name = get_comment_author( $parent->comment_ID ); + ?> +
+ ' . $name . '' + ); ?> +
+ comment_parent ) { $parent = get_comment( $comment->comment_parent ); - $parent_link = esc_url( get_comment_link( $parent ) ); - $name = get_comment_author( $parent ); - printf( ' | '.__( 'In reply to %2$s.' ), $parent_link, $name ); + if ( $parent ) { + $parent_link = esc_url( get_comment_link( $parent ) ); + $name = get_comment_author( $parent ); + printf( ' | '.__( 'In reply to %2$s.' ), $parent_link, $name ); + } } echo '';