diff --git a/wp-admin/post.php b/wp-admin/post.php index d8da597b6d..107a4f7c03 100644 --- a/wp-admin/post.php +++ b/wp-admin/post.php @@ -335,12 +335,9 @@ case 'editedcomment': edit_comment(); - $referredby = $_POST['referredby']; - if (!empty($referredby)) { - wp_redirect($referredby); - } else { - wp_redirect("edit.php?p=$comment_post_ID&c=1#comments"); - } + $location = ( empty($_POST['referredby']) ? "edit.php?p=$comment_post_ID&c=1" : $_POST['referredby'] ) . '#comment-' . $comment_ID; + $location = apply_filters('comment_edit_redirect', $location, $comment_ID); + wp_redirect($location); break; diff --git a/wp-comments-post.php b/wp-comments-post.php index 3be6142c62..67133b450e 100644 --- a/wp-comments-post.php +++ b/wp-comments-post.php @@ -57,8 +57,9 @@ if ( !$user->ID ) : setcookie('comment_author_url_' . COOKIEHASH, clean_url($comment->comment_author_url), time() + 30000000, COOKIEPATH, COOKIE_DOMAIN); endif; -$location = ( empty( $_POST['redirect_to'] ) ) ? get_permalink( $comment_post_ID ) : $_POST['redirect_to']; +$location = ( empty($_POST['redirect_to']) ? get_permalink($comment_post_ID) : $_POST['redirect_to'] ) . '#comment-' . $comment_id; +$location = apply_filters('comment_post_redirect', $location, $comment); -wp_redirect( $location ); +wp_redirect($location); ?>