wpseek.com
Uma área de pesquisa sobre o WordPress para devs e autores do tema



wp_loginout › WordPress Function

Desde1.5.0
Obsoleton/a
wp_loginout ( $redirect = '', $display = true )
Parâmetros: (2)
  • (string) $redirect Optional path to redirect to on login/logout.
    Required: No
    Padrão: (empty)
  • (bool) $display Default to echo and not return the link.
    Required: No
    Padrão: true
Retorna:
  • (void|string) Void if `$display` argument is true, log in/out link if `$display` is false.
Definido em:
Codex:

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.


Fonte

function wp_loginout( $redirect = '', $display = true ) {
	if ( ! is_user_logged_in() ) {
		$link = '<a href="' . esc_url( wp_login_url( $redirect ) ) . '">' . __( 'Log in' ) . '</a>';
	} else {
		$link = '<a href="' . esc_url( wp_logout_url( $redirect ) ) . '">' . __( 'Log out' ) . '</a>';
	}

	if ( $display ) {
		/**
		 * 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 );
	}
}