In WordPress when a user comments on an Article, post or page he is redirected to the same page after commenting.
But in some scenarios it is required that user should be redirected to some other URL after commenting. This can be done with a simple piece of code.
Open your active theme's functions.php file and add the following line at the end of the line.
But in some scenarios it is required that user should be redirected to some other URL after commenting. This can be done with a simple piece of code.
Open your active theme's functions.php file and add the following line at the end of the line.
function wp_comment_redirect_url($location) {
return "http://www.yourdomain.com";
}
add_filter('comment_post_redirect', 'wp_comment_redirect_url');
Now user will be redirected to the URL to have set.
No comments:
Post a Comment