WordPress.org

Ready to get started?Download WordPress

Codex

Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Difference between revisions of "Plugin API/Filter Reference/login headerurl"

(Updated get_bloginfo( 'siteurl' ); to get_bloginfo( 'url' ); to avoid deprecation error.)
m (Fixed capitalization of WordPress)
 
Line 2: Line 2:
 
{{en|Plugin API/Filter Reference}}
 
{{en|Plugin API/Filter Reference}}
 
}}
 
}}
The <b>"login_headerurl"</b> filter is used to filter the url of the logo in wordpress login page. By default this logo links to wordpress site.
+
The <b>"login_headerurl"</b> filter is used to filter the url of the logo in WordPress login page. By default this logo links to WordPress site.
   
 
A plugin can register as a content filter with the code:
 
A plugin can register as a content filter with the code:
Line 10: Line 10:
 
Where "plugin_function_name" is the function WordPress should call when the content is being retrieved. Note that the filter function the plugin defines <b>must</b> return the url after it is finished processing, or the logo may not have any links and other plugins also filtering the same may generate errors.
 
Where "plugin_function_name" is the function WordPress should call when the content is being retrieved. Note that the filter function the plugin defines <b>must</b> return the url after it is finished processing, or the logo may not have any links and other plugins also filtering the same may generate errors.
   
You can also use this in the theme function.php file within your wordpress page if you don't wish to use a plugin or want to distribute your theme.
+
You can also use this in the theme function.php file within your WordPress page if you don't wish to use a plugin or want to distribute your theme.
   
 
=== Example ===
 
=== Example ===

Latest revision as of 16:43, 18 December 2012

The "login_headerurl" filter is used to filter the url of the logo in WordPress login page. By default this logo links to WordPress site.

A plugin can register as a content filter with the code:

add_filter("login_headerurl","plugin_function_name");

Where "plugin_function_name" is the function WordPress should call when the content is being retrieved. Note that the filter function the plugin defines must return the url after it is finished processing, or the logo may not have any links and other plugins also filtering the same may generate errors.

You can also use this in the theme function.php file within your WordPress page if you don't wish to use a plugin or want to distribute your theme.

Example

In the below example the logo's default link is changed to the site url.

function the_url( $url ) {
    return get_bloginfo( 'url' );
}
add_filter( 'login_headerurl', 'the_url' );

See Also

http://codex.wordpress.org/Plugin_API#Create_a_Filter_Function

External Resources