wp_deregister_style( string $handle )

Removes a registered stylesheet.


Description

Top ↑

See also


Top ↑

Parameters

$handle string Required
Name of the stylesheet to be removed.

Top ↑

Source

File: wp-includes/functions.wp-styles.php. View all references

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

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


Top ↑

Changelog

Changelog
Version Description
2.1.0 Introduced.

Top ↑

User Contributed Notes

  1. Skip to note 1 content
    Contributed by tazotodua

    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.