After someone submits a comment this line of codes redirects him to the post (i believe).
Can I modify the code in order to redirect him to a custom URL?
do_action(‘comment_form’, $post->ID)
Ty for the answer,
UPDATE:
my comments.php
<form>
.......
<input name="submit" type="submit" id="submit" tabindex="5" value="Submit" />
<input type="hidden" name="my_redirect_to" value="http://www.google.com"; />
<?php comment_id_fields(); ?>
<?php do_action('comment_form', $post->ID); ?>
</form>
my functions.php
add_action('comment_post_redirect', 'redirect_to_thank_page'); // Redirect to thank you post after comment
function redirect_to_thank_page() {
if ( isset( $_POST['my_redirect_to'] ) )
return $_POST['my_redirect_to'];
}
The code does not work, it’s not redirecting to google.com for example.
Any ideas why?
Ty