Home  >  Article  >  Backend Development  >  WordPress code to determine whether the user is logged in_PHP tutorial

WordPress code to determine whether the user is logged in_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 15:31:151014browse

is_user_logged_in()
Description
Returns a Boolean value of true or false depending on whether the current visitor is logged in.

Parameters
This function does not accept any parameters.

Usage

Copy code The code is as follows:



Example
Use the is_user_logged_in() function to display different output results in the theme file according to the login status of the current visitor.
Copy code The code is as follows:

if ( is_user_logged_in() ) {
echo 'Welcome, registered user!';
} else {
echo 'Welcome, visitor!';
}
?>


Reference link: Function Reference/is user logged in

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/323065.htmlTechArticleis_user_logged_in() Description Returns a Boolean value of true or false depending on whether the current visitor is logged in. Parameters This function does not accept any parameters. Usage Copy the code The code is as follows: ?php if ( is_us...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn