0

I want to disable a profile sidebar when users are logout

if (is_active_sidebar('profile')) :
    if ( is_user_logged_in() ) :
        dynamic_sidebar('profile');
    else :
        dynamic_sidebar('-----');//fake name
    endif;
endif;

I put the above code in function.php but does not work.

1
  • It's not going to do anything in functions.php. You need to add the check in the template wherever the sidebar is originally output. Dec 12, 2023 at 10:33

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.