Answer the question
In order to leave comments, you need to log in
How to exclude child endpoint from myaccount redirect?
Users should not see the default login-registration form on the myaccount page. Must log in through the pop-up form, which is in the header of the site.
If you click on the icon of a person, then registered people will go to their account, and a pop-up form will open for unregistered people.
add_action('wp_logout','auto_redirect_after_logout');
function auto_redirect_after_logout(){
wp_redirect( home_url() );
exit();
}
add_action( 'template_redirect', 'wish_custom_redirect' );
function wish_custom_redirect() {
global $wp;
if (!is_user_logged_in() && is_page('my-account') ) {
wp_redirect( '/' );
exit;
}
}
add_action( 'template_redirect', 'wish_custom_redirect' );
function wish_custom_redirect() {
global $wp;
if (!is_user_logged_in() && is_page('my-account') && !is_page('my-account/lost-password/') ) {
wp_redirect( '/' );
exit;
}
}
Answer the question
In order to leave comments, you need to log in
You need to steer through is_user_logged_in
if ( is_user_logged_in() ) {
echo 'Вы авторизованы на сайте!';
}
else {
echo 'Вы всего лишь пользователь!';
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question