Skip to content

password_protected_stylesheet_file

Ben Huson edited this page Mar 26, 2015 · 1 revision

This filter allows you to provide a path to a different stylesheet file.

The css file path must be within your theme and the path you supply must be relative to your theme folder.

The following example with load a stylesheet password-protected.css within a css folder of your theme.

function password_protected_stylesheet_file( $file ) {
	return '/css/password-protected.css';
}
add_filter( 'password_protected_stylesheet_file', 'my_ password_protected_stylesheet_file' );

If you need to load a stylesheet from elsewhere such as a plugin, you will need to dequeue the password-protected-login stylesheet and enqueue one from your preferred location.

function dequeue_password_protected_login_style() {
	wp_dequeue_style( 'password-protected-login' );
	// Load your own stylesheet here
}
add_action( 'login_enqueue_scripts', array( $this, 'dequeue_password_protected_login_style' ) );