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.