WordPress redirection

WordPress redirection is useful in some situations. For example, wordpress redirects to the dashboard after login, and the WordPress logout redirect occurs when the use logs out, which takes the user to the login page . Anther example of wordpress redirection is  after you complete registration and  you may not want to stay on the registration page. Usually wordpress redirects user to the home page or to the previous page after registration.

WordPress realizes the redirection by doing the “template_redirect” action before loading the current template to display the page. If you want to redirect a page to another page, you should hook a function to the action. In that hooked function, you should check if the to-be-loaded page template is what you expect the redirection occurs on, if it is, redirect the user to the specified url. The redirection url can be provided as a GET or POST variable.

If you like my content, please consider buying me a coffee. Buy me a coffeeBuy me a coffee Thank you for your support!

Leave a Reply