wp_loginout()

wp_loginout( string $redirect = ”, bool $echo = true ) …

wp_loginout( string $redirect = , bool $echo = true )

显示登录/注销链接。
Display the Log In/Out link.

目录锚点:#说明#参数#源码#笔记


说明(Description)

显示一个链接,该链接允许用户导航到登录页以登录或注销,具体取决于他们当前是否已登录。


参数(Parameters)

参数 类型 说明
$redirect (string) 登录/注销时重定向到的路径。
$echo (bool) 默认为echo,不返回链接。

源码(Source)

/**
 * Display the Log In/Out link.
 *
 * Displays a link, which allows users to navigate to the Log In page to log in
 * or log out depending on whether they are currently logged in.
 *
 * @since 1.5.0
 *
 * @param string $redirect Optional path to redirect to on login/logout.
 * @param bool   $echo     Default to echo and not return the link.
 * @return string|void String when retrieving.
 */
function wp_loginout($redirect = '', $echo = true) {
	if ( ! is_user_logged_in() )
		$link = '' . __('Log in') . '';
	else
		$link = '' . __('Log out') . '';

	if ( $echo ) {
		/**
		 * Filter the HTML output for the Log In/Log Out link.
		 *
		 * @since 1.5.0
		 *
		 * @param string $link The HTML link content.
		 */
		echo apply_filters( 'loginout', $link );
	} else {
		/** This filter is documented in wp-includes/general-template.php */
		return apply_filters( 'loginout', $link );
	}
}
更新版本 源码位置 使用 被使用
1.5.0 wp-includes/general-template.php 2 20

笔记(Notes)

基本示例

类别:WordPress 函数手册

本文收集自互联网,转载请注明来源。
如有侵权,请联系 wper_net@163.com 删除。

评论 (0)COMMENT

登录 账号发表你的看法,还没有账号?立即免费 注册