Comments: Check if a valid comment ID was passed when editing a comment.
This avoids a PHP notice after submitting the Edit Comment form. Props regan.khadgi. Fixes #51263. git-svn-id: https://develop.svn.wordpress.org/trunk@48958 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
92bf360a03
commit
427d72c8a1
@ -36,14 +36,18 @@ if ( isset( $_GET['dt'] ) ) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$comment_id = absint( $_GET['c'] );
|
if ( isset( $_REQUEST['c'] ) ) {
|
||||||
$comment = get_comment( $comment_id );
|
$comment_id = absint( $_REQUEST['c'] );
|
||||||
|
$comment = get_comment( $comment_id );
|
||||||
|
|
||||||
// Prevent actions on a comment associated with a trashed post.
|
// Prevent actions on a comment associated with a trashed post.
|
||||||
if ( 'trash' === get_post_status( $comment->comment_post_ID ) ) {
|
if ( $comment && 'trash' === get_post_status( $comment->comment_post_ID ) ) {
|
||||||
wp_die(
|
wp_die(
|
||||||
__( 'You can’t edit this comment because the associated post is in the Trash. Please restore the post first, then try again.' )
|
__( 'You can’t edit this comment because the associated post is in the Trash. Please restore the post first, then try again.' )
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$comment = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ( $action ) {
|
switch ( $action ) {
|
||||||
|
Loading…
Reference in New Issue
Block a user