0

how to redirect the error message page "Sorry, you are not allowed to access this page." to the Home page?

0

I think that is a function of the theme, which will return that message under whatever conditions it defined. (Hard to say exactly what file of the theme, since you didn't specify the theme name. But a search for that phrase should find the file.)

If I am correct, then you should (best practice) make a child theme, then copy the theme's PHP file that displays that message into the child theme folder. Then edit the file in the child theme folder to change the part of the code that displays the message to a wp_redirect() (see https://developer.wordpress.org/reference/functions/wp_redirect/ ) . Make sure you include the exit command after the wp_direct() .

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.