wp_deregister_style( string $handle )

Removes a registered stylesheet.

Description

See also

Parameters

$handlestringrequired
Name of the stylesheet to be removed.

Source

function wp_deregister_style( $handle ) {
	_wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle );

	wp_styles()->remove( $handle );
}

Changelog

VersionDescription
2.1.0Introduced.

User Contributed Notes

  1. Skip to note 2 content

    Example:

    add_action( 'wp_enqueue_scripts', 'remove_default_stylesheet', 20 );
    function remove_default_stylesheet() {
        wp_dequeue_style( 'original-enqueue-stylesheet-handle' );
        wp_deregister_style( 'original-register-stylesheet-handle' );
    
        wp_register_style( 'new-style', get_stylesheet_directory_uri() . '/new.css', false, '1.0.0' ); 
        wp_enqueue_style( 'new-style' );
    }

You must log in before being able to contribute a note or feedback.