wp_loginout
函数
wp_loginout ( $redirect = '', $echo = true )
- 参数
-
-
(string)
$redirect
Optional path to redirect to on login/logout.- Required: 否
- Default: (empty)
-
(bool)
$echo
Default to echo and not return the link.- Required: 否
- Default: true
-
(string)
- 返回值
-
- (void|string) Void if `$echo` argument is true, log in/out link if `$echo` is false.
- 定义位置
-
-
wp-includes/general-template.php
, line 376
-
wp-includes/general-template.php
- 引入
- 1.5.0
- 弃用
- –
Displays 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.
function wp_loginout( $redirect = '', $echo = true ) { if ( ! is_user_logged_in() ) { $link = '' . __( 'Log in' ) . ''; } else { $link = '' . __( 'Log out' ) . ''; } if ( $echo ) { /** * Filters 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 ); } }
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。