$comment =
get_comment( $comment_id );
if ( !
$comment ) { comment_footer_die( __( 'Invalid comment ID.'
) .
sprintf( ' <a href="%s">' .
__( 'Go back'
) . '</a>.', 'edit-comments.php'
) );
} if ( !
current_user_can( 'edit_comment',
$comment->comment_ID
) ) { comment_footer_die( __( 'Sorry, you are not allowed to edit comments on this post.'
) );
} if ( wp_get_referer() && !
$noredir && !
str_contains( wp_get_referer(), 'comment.php'
) ) { $redir =
wp_get_referer();
} elseif ( wp_get_original_referer() && !
$noredir ) { $redir =
wp_get_original_referer();
} elseif ( in_array( $action, array
( 'approvecomment', 'unapprovecomment'
), true
) ) { $redir =
admin_url( 'edit-comments.php?p=' .
absint( $comment->comment_post_ID
) );
} else { $redir =
admin_url( 'edit-comments.php'
);
} $redir =
remove_query_arg( array
( 'spammed', 'unspammed', 'trashed', 'untrashed', 'deleted', 'ids', 'approved', 'unapproved'
),
$redir );
switch ( $action ) { case 'deletecomment':