Answers for "check user is logged in wp and is admin"

PHP
10

wp get logged in user id

<?php
	$user_id = get_current_user_id();
?>
Posted by: Guest on April-14-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

Browse Popular Code Answers by Language