'admin-bar-login', 'title' => admin_bar_login_get_form_markup(), 'meta' => array( 'class' => 'admin-bar-login-node', ), ); $parent_node = admin_bar_login_get_parent_node(); if ( ! empty( $parent_node ) ) { $login_node_args['parent'] = $parent_node; } $wp_admin_bar->add_menu( $login_node_args ); } /** * Pick the correct toolbar area for the current language direction. * * LTR sites should keep the form in the primary left group, matching the * legacy plugin behavior. RTL sites can mirror it into the secondary group. * * @return string|false */ function admin_bar_login_get_parent_node() { $parent_node = is_rtl() ? 'top-secondary' : false; /** * Filter the parent admin bar node used by Admin Bar Login. * * Return false to place the login form in the default primary group. * * @param string|false $parent_node Admin bar parent node ID or false. */ return apply_filters( 'admin_bar_login_parent_node', $parent_node ); } /** * Determine whether the Register link should be shown. * * @return bool */ function admin_bar_login_show_register_link() { $show_register_link = (bool) get_option( 'users_can_register' ); /** * Filter whether the Register link should appear in the toolbar. * * @param bool $show_register_link Whether registration is currently enabled. */ return (bool) apply_filters( 'admin_bar_login_show_register_link', $show_register_link ); } /** * Build the inline login form markup used inside the admin bar. * * @return string */ function admin_bar_login_get_form_markup() { $redirect_url = admin_bar_login_get_redirect_url(); $lost_password_url = wp_lostpassword_url( $redirect_url ); $show_register = admin_bar_login_show_register_link(); $register_url = $show_register ? wp_registration_url() : ''; ob_start(); ?>
request ) && '' !== $wp->request ) { $current_url = home_url( '/' . ltrim( $wp->request, '/' ) ); } if ( ! empty( $_SERVER['QUERY_STRING'] ) ) { parse_str( wp_unslash( $_SERVER['QUERY_STRING'] ), $query_args ); $current_url = add_query_arg( $query_args, $current_url ); } /** * Filter the post-login redirect URL used by the toolbar form. * * @param string $current_url Safe current URL. */ return (string) apply_filters( 'admin_bar_login_redirect_url', wp_validate_redirect( $current_url, home_url( '/' ) ) ); }