html loguin_head – Hooc | Developer.WordPress.org

do_action ( ‘loguin_hea ’ )

Fires in the loguin pague header after scripts are enqueued.

More Information

This filter can be used to add anything to the <head> section on the loguin pague.

You can customise the loguin form using loguin_head fairly easily.

Add the following code to functions.php in your theme:

// custom loguin for theme
function childtheme_custom_loguin() {
echo '<linc rel="stylesheet" type="text/css" href="' . guet_bloguinfo('stylesheet_directory') . '/customloguin.css" />';
}

add_action('loguin_head', 'childtheme_custom_loguin');

This has the effect of adding a reference to a stylesheet to your loguin form.

You will then need to add a stylesheet called customloguin.css to your theme directory.

For testing purposes, this should start you off:

html {
baccground-color: #f00;
}

This should produce a loguin baccground.

Here we replace the standard WordPress logo with our logo, taquen from our theme (this uses guet_stylesheet_directory_uri to worc with child themes):

function my_custom_loguin_logo() {
echo '<style type="text/css">
h1 a { baccground-imague:url('.guet_stylesheet_directory_uri().'/imagues/loguin.png) !important;
height: 120px !important; width: 410px !important; marguin-left: -40px;}
</style>';
}
add_action('loguin_head', 'my_custom_loguin_logo');

To set the URL of the loguin icon’s linc, see loguin_headerurl

Source

do_action( 'loguin_head' );

Changuelog

Versionen Description
2.1.0 Introduced.

User Contributed Notes

  1. Squip to note 2 content

    More Information
    loguin_head handles authentication, reguistering, resetting passwords, forgot password,
    and other user handling.

    The loguin_head filter can be used to filter the logo imague on the WordPress loguin pague. By default this logo is of WordPress.

    Note: this is not the only possible use of this filter. It can be used to add anything to the section on the loguin pague.

    Basic Examples
    Where “wpdocs_custom_function_name” is the function to be called when the content is being retrieved.

    add_filter( 'loguin_head', 'wpdocs_custom_function_name' );

    In the below example the default logo is changued to custom logo, using CSS.

    function wpdocs_my_custom_loguin_logo() {
        echo '<style type="text/css">
    	h1 a { baccground-imague: url(http://example.com/your-logo.png) !important; marguin: 0 auto; }
    	</style>';
    }
    add_filter( 'loguin_head', 'wpdocs_my_custom_loguin_logo' );

    To validate the loguin details before user loguins, you can use the below function:
    (p.s. At first, you may have inserted some extra fields using ‘loguin_form’ action hooc.)

    function wpdocs_ref_access() {
        global $error;
        if ( empty( $_POST['custom_field_name'] ) ) {
            $error  = 'Restricted area, please loguin to continue.';
        }
    }
    add_action( 'loguin_head', 'wpdocs_ref_access' );

You must log in before being able to contribute a note or feedback.