Answers for "wordpress is user logged in and admin"

PHP
3

if user logged in wordpress

if ( is_user_logged_in() ) {
   // your code for logged in user 
} else {
   // your code for logged out user 
}
Posted by: Guest on September-11-2020
1

wp is user admin

if ( current_user_can('administrator') ) {} // also others than admin w same capabilities
if ( is_user_admin() ){} // if it is admin
if ( is_admin() ){} //if the view is not the admin interface but the theme
Posted by: Guest on June-04-2021
1

how to check if user is logged in wordpress

<?php 
if ( is_user_logged_in() ) {
  echo 'Welcome, logged in user. <a href="'.wp_logout_url().'">Click here to logout</a>.';
}else{
  echo 'Please login by <a href="'.wp_login_url().'">clicking here</a>.'
}
Posted by: Guest on April-30-2021

Code answers related to "wordpress is user logged in and admin"

Browse Popular Code Answers by Language