I’m trying to redirect wordpress commentors on a page by page basis. I’ve tried the WordPress plugins that redirect after comments. But they will only allow me to redirect all comments to one page. I was able to find this snippet of code to add to my functions.php
add_filter('comment_post_redirect', 'redirect_after_comment');
function redirect_after_comment(){
wp_redirect('/page/');
exit();
}
However, it too will only allow me to redirect all commentors to one page.
What I’d like to be able to do is redirect a commentor on Post A to Page D, while a commentor on Post B would go to Page F.
I’ve tried to use a custom field to add a unique redirect URL per post. But when I attempt to the add get_post_meta() inside the wp_redirect brackets I get a blank screen.
Any ideas how it could work?
The topic ‘Redirect after Comments post by post’ is closed to new replies.
(@ngn-rashell)
14 years, 2 months ago
I’m trying to redirect wordpress commentors on a page by page basis. I’ve tried the WordPress plugins that redirect after comments. But they will only allow me to redirect all comments to one page. I was able to find this snippet of code to add to my functions.php
However, it too will only allow me to redirect all commentors to one page.
What I’d like to be able to do is redirect a commentor on Post A to Page D, while a commentor on Post B would go to Page F.
I’ve tried to use a custom field to add a unique redirect URL per post. But when I attempt to the add get_post_meta() inside the wp_redirect brackets I get a blank screen.
Any ideas how it could work?