wp_loginout()获取一个退出链接

目录

描述

Displays a login link, or if a user is logged in, displays a logout link. An optional, redirect argument can be used to redirect the user upon login or logout.

wp_loginout() 描述

用法

 <?php wp_loginout$redirect$echo ); ?> 

wp_loginout() 用法

参数

$redirect

(string) (可选) URL to redirect to on login/logout.

默认值: None

$echo

(boolean) (可选) If true, echos the link, if false, returns the link as a string.

默认值: true

wp_loginout() 参数

示例

Basic Example

Add Log in/out Link To Nav Menu

Simply add this code to your parent or child themes functions.php file to display a log in/out link in the secondary navigation menu of the Twenty Fourteen default theme for WordPress.

Other themes like Twenty Thirteen may require you to add a class to the code like this example.

wp_loginout() 示例

注意

wp_loginout() 注意

历史

添加于 版本: 1.5

The $redirect parameter is added in Version 2.8.

wp_loginout() 历史

源文件

wp_loginout() 函数的代码位于 wp-includes/general-template.php.

wp_loginout() 源文件

相关