[wp-hackers] Removing wp_admin_css from login only

Jeremy Visser jeremy.visser at gmail.com
Thu Jan 15 11:24:47 GMT 2009


On Thu, 2009-01-15 at 16:22 +1300, Lynne Pope wrote:
> I need to remove the wp_admin_css from the login screen only and am having a
> heck of a time working out how to do this.
> 
> I have a custom login using my own stylesheets through my themes functions.
> I don't need the admin css to load into the headers.

This ought to do the trick:

        <?php
        /*
        Plugin Name: Kill Login CSS
        */
        
        function kill_login_css($tag) {
        	return '';
        }
        if (basename($_SERVER['PHP_SELF']) == 'wp-login.php')
        	add_action('style_loader_tag', 'kill_login_css');
        
        ?>

Not sure if there's a better way to do it.

You can't do an add_filter('wp_admin_css'), because wp-login.php calls
wp_admin_css( 'login', true ), where the "true" means "force echo",
which means it bypasses the wp_admin_css filter. (This is the point
where the cyanide comes in.)

I haven't looked at that part of the WP codebase in years, and it's
downright scary. I mean, take a look at this snippet:

        $ver = $this->registered[$handle]->ver ?
        	$this->registered[$handle]->ver : $this->default_version;
        if ( isset($this->args[$handle]) )
        	$ver .= '&amp;' . $this->args[$handle];

I don't know what it is, but it's not poetry. (Nothing personal against
whoever wrote it -- I can't really talk, can I?)

-- 
Jeremy Visser                                 http://jeremy.visser.name/

No Internet Censorship for Australia             http://nocleanfeed.com/



More information about the wp-hackers mailing list