How to Redirect to custom page after logged in and comment
Md Abul Bashar | 4,933 views | August 16, 2016 | Tips And Tricks | No | 11:19 AM |
Hello Everyone, Today I will teach you how to redirect custom page after logged in or how to redirect custom page after any people commented on your website, it’s very easy just need write one function for redirect after logged in any user and one function for redirect after submit comment any people. so now we’ll go to work.
just copy below codes and past in your functions.php file on your activated theme [For logged in user redirect] you can change function name, but don’t change filter function (‘login_redirect’)
function login_redirect_user( $redirect_to, $request, $user ){ return home_url('custom-page-url.extension'); //Custom page url extension where want redirect } add_filter( 'login_redirect', 'login_redirect_user', 10, 3 );
Now if you want to redirect people after submit comment on your website then just copy below codes and past in your functions.php file on your activated theme. you can change function name, but don’t change filter name ‘comment_post_redirect’
function comment_redirect($location) { return 'http://www.yoursite.com/thanks.html'; } add_filter('comment_post_redirect', 'comment_redirect');
You have to enjoy this articel? Don't forget subscribes this site.
If you want to get our update article, then please subscribe this site.
This title last post
4,933 views | August 16, 2016 | 11:19 AM