comment_post_redirect
Filter HookDescription
Filters the location URI to send the commenter after posting.Hook Information
File Location |
wp-comments-post.php
View on GitHub
|
Hook Type | Filter |
Line Number | 78 |
Hook Parameters
Type | Name | Description |
---|---|---|
string
|
$location
|
The 'redirect_to' URI sent via $_POST. |
WP_Comment
|
$comment
|
Comment object. |
Usage Examples
Basic Usage
<?php
// Hook into comment_post_redirect
add_filter('comment_post_redirect', 'my_custom_filter', 10, 2);
function my_custom_filter($location, $comment) {
// Your custom filtering logic here
return $location;
}
Source Code Context
wp-comments-post.php:78
- How this hook is used in WordPress core
<?php
73 * @since 2.0.5
74 *
75 * @param string $location The 'redirect_to' URI sent via $_POST.
76 * @param WP_Comment $comment Comment object.
77 */
78 $location = apply_filters( 'comment_post_redirect', $location, $comment );
79
80 wp_safe_redirect( $location );
81 exit;
PHP Documentation
<?php
/**
* Filters the location URI to send the commenter after posting.
*
* @since 2.0.5
*
* @param string $location The 'redirect_to' URI sent via $_POST.
* @param WP_Comment $comment Comment object.
*/
Quick Info
- Hook Type: Filter
- Parameters: 2
- File: wp-comments-post.php
Related Hooks
Related hooks will be displayed here in future updates.