Answers for "wp if user is logged in"

PHP
10

wp get logged in user id

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

Browse Popular Code Answers by Language