# Load a login.css File From Your Theme

> Loads login.css from the active (child) theme folder on the login page, so you can style it with a regular stylesheet.

- Type: PHP
- Runs: Run everywhere
- Category: [Login](https://wpide.com/library/category/login/)
- Tags: login, css, theme
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/login-css-from-theme/

## Code

```php
add_action( 'login_enqueue_scripts', function () {
    $path = get_stylesheet_directory() . '/login.css';

    if ( file_exists( $path ) ) {
        wp_enqueue_style( 'wpide-theme-login', get_stylesheet_directory_uri() . '/login.css', array( 'login' ), (string) filemtime( $path ) );
    }
} );
```

## Notes

The file version updates automatically when you edit it, so browsers do not keep an old copy.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Load a login.css File From Your Theme" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
