^ 回到顶部
  • 人生没有定律,每个人都有自己的节奏
  • 本站wordpress建站教程均通过实践后发布,希望对你有帮助,如果有代码出错,请联系站长解决
  • 希望你的坚持,都是因为热爱,而不是因为不甘心
  • 8年wordpress建站经验,5星服务品质
  • 那些不愿意让你吃亏的人,才是真正值得你深交的人,也是值得你付出时间的人
  • 阿里云2核2g仅需86元/年

wordpress函数wp_login_url()用法示例

wp_login_url( string $redirect = '',  bool $force_reauth = false )

Retrieves the login URL.


描述


参数

$redirect

(string)
(Optional)
Path to redirect to on log in.

新用户2核2g仅需86元/年    领取1153套模板    免费cdn流量包    ¥3188礼包

Default value: ''

$force_reauth

(bool)
(Optional)
Whether to force reauthorization, even if a cookie is present.

Default value: false


返回值

(string) The login URL. Not HTML-encoded.


源代码

File: wp-includes/general-template.php

function wp_login_url($redirect = '', $force_reauth = false) {
	$login_url = site_url('wp-login.php', 'login');

	if ( !empty($redirect) )
		$login_url = add_query_arg('redirect_to', urlencode($redirect), $login_url);

	if ( $force_reauth )
		$login_url = add_query_arg('reauth', '1', $login_url);

	/**
	 * Filters the login URL.
	 *
	 * @since 2.8.0
	 * @since 4.2.0 The `$force_reauth` parameter was added.
	 *
	 * @param string $login_url    The login URL. Not HTML-encoded.
	 * @param string $redirect     The path to redirect to on login, if supplied.
	 * @param bool   $force_reauth Whether to force reauthorization, even if a cookie is present.
	 */
	return apply_filters( 'login_url', $login_url, $redirect, $force_reauth );
}

更新日志

Version 描述
2.7.0 Introduced.

相关函数

Uses

  • wp-includes/general-template.php:
    login_url
  • wp-includes/functions.php:
    add_query_arg()
  • wp-includes/link-template.php:
    site_url()
  • wp-includes/plugin.php:
    apply_filters()

Used By

  • wp-includes/class-wp-customize-manager.php:
    WP_Customize_Manager::customize_pane_settings()
  • wp-signup.php:
    confirm_another_blog_signup()
  • wp-admin/includes/network.php:
    network_step2()
  • wp-admin/includes/upgrade.php:
    wp_new_blog_notification()
  • wp-includes/pluggable.php:
    wp_new_user_notification()
  • wp-includes/pluggable.php:
    auth_redirect()
  • wp-includes/general-template.php:
    wp_loginout()
  • wp-includes/functions.php:
    wp_auth_check_html()
  • wp-includes/canonical.php:
    wp_redirect_admin_locations()
  • wp-includes/ms-functions.php:
    wpmu_welcome_user_notification()
  • wp-includes/class-wp-xmlrpc-server.php:
    wp_xmlrpc_server::initialise_blog_option_info()
  • wp-includes/comment-template.php:
    get_post_reply_link()
  • wp-includes/comment-template.php:
    comment_form()
  • wp-includes/comment-template.php:
    get_comment_reply_link()
  • Show 9 more used by
    Hide more used by


  1. Skip to note content

    You must log in to vote on the helpfulness of this noteVote results for this note: 0You must log in to vote on the helpfulness of this note

    Contributed by Codex

    Basic Example

    
    <a href="<?php echo esc_url( wp_login_url() ); ?>" alt="<?php esc_attr_e( 'Login', 'textdomain' ); ?>">
    	<?php _e( 'Login', 'textdomain' );
    </a>
    
  2. Login and Redirect to Current Page

    
    <a href="<?php echo esc_url( wp_login_url( get_permalink() ) ); ?>" alt="<?php esc_attr_e( 'Login', 'textdomain' ); ?>">
    	<?php _e( 'Login', 'textdomain' ); ?>
    </a>
    

    Login and Redirect to Homepage

    
    <a href="<?php echo esc_url( wp_login_url( home_url() ) ); ?>" alt="<?php esc_attr_e( 'Login', 'textdomain' ); ?>">
    	<?php _e( 'Login', 'textdomain' ); ?>
    </a>
    

让小雨知道,这篇文章帮到了你
扫码关注微信公众号zs40086(微搜片)随时随地微信看片,抢先福利电影等你来

热门推荐

如有疑问,请前往问答中心反馈!

反馈