wp_deregister_style( string $handle )

Remove a registered stylesheet.


Description Description

See also See also


Top ↑

Parameters Parameters

$handle

(string) (Required) Name of the stylesheet to be removed.


Top ↑

Source Source

File: wp-includes/functions.wp-styles.php

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

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

Top ↑

Changelog Changelog

Changelog
Version Description
2.1.0 Introduced.


Top ↑

User Contributed Notes 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.