comment_post_redirect
Filters the location URI to send the commenter after posting.
Usage
add_filter( 'comment_post_redirect', 'wp_kama_comment_post_redirect_filter', 10, 2 );
/**
* Function for `comment_post_redirect` filter-hook.
*
* @param string $location The 'redirect_to' URI sent via $_POST.
* @param WP_Comment $comment Comment object.
*
* @return string
*/
function wp_kama_comment_post_redirect_filter( $location, $comment ){
// filter...
return $location;
}
- $location(string)
- The 'redirect_to' URI sent via $_POST.
- $comment(WP_Comment)
- Comment object.
Changelog
| Since 2.0.5 | Introduced. |
Where the hook is called
In file: /wp-comments-post.php
comment_post_redirect
wp-comments-post.php 78
$location = apply_filters( 'comment_post_redirect', $location, $comment );