This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.
login_headertitle Filter
Filters the title attribute of the header logo above the login form.
To use the login_headertitle filter, you first need to register it using add_filter. You can include this code in the functions.php file of your active theme, or in a custom WordPress Plugin.
At WePlugins, we always recommend creating a custom WordPress Plugin when using hooks to ensure nothing breaks when you update your WordPress Theme in the future.
In the live example below, we have defined a function modify_login_headertitle_defaults which takes one parameter, and we register it using add_filter. The first parameter login_headertitle is the name of the hook, the second parameter modify_login_headertitle_defaults is the name of the function to be called, the third parameter is the priority of calling the hook if the same hook is used multiple times, and the last parameter is the number of arguments (if any) to be passed to the registered function.
Sometimes, you need to remove a registered hook, so you can use remove_filter to remove the login_headertitle filter.
Parameters
- $login_header_title : (string) Login header logo title attribute.
Below is the one parameter required to use this hook:
Live Examples
Example 1: Basic Usage of login_headertitle Filter
In this example, we show how to conditionally add the filter based on the WordPress version.
if ( version_compare( $GLOBALS['wp_version'], '5.2', '<' ) ) { add_filter( 'login_headertitle', 'weplugins_custom_function' ); } else { add_filter( 'login_headertext', 'weplugins_custom_function' ); } [/php] <h3>Example 2: Modifying the Login Header Title</h3> <p>Below is an example of how you can use this hook to modify the login header title.</p> function weplugins_modify_login_headertitle_defaults($login_header_title) { // Update the $login_header_title variable according to your website requirements and return this variable. // You can modify the $login_header_title variable conditionally too if you want. return $login_header_title; } // add the filter add_filter( "login_headertitle", "weplugins_modify_login_headertitle_defaults", 10, 1 );
Example 3: Removing the Hook Callback
To remove a hook callback, use the example below. Ensure you provide the same callback function name, priority, and number of arguments while removing the hook callback.
remove_filter( "login_headertitle", "weplugins_modify_login_headertitle_defaults", 10, 1 );
Contact Us
If you need any customization or assistance, feel free to contact us.
Explore the latest in WordPress
Trying to stay on top of it all? Get the best tools, resources and inspiration sent to your inbox every Wednesday.