wp_deregister_style()WP 2.1.0

Remove a registered stylesheet.

1 time — -0.00003 sec (speed of light) | 50000 times — 0.02 sec (speed of light) | PHP 7.4.8, WP 5.8.1

No Hooks.

Return

null. Nothing (null).

Usage

wp_deregister_style( $handle );
$handle(string) (required)
Name of the stylesheet to be removed.

Examples

0

#1 Unregister the styles file

Suppose style with ID my_style was registered on init hook and we need to delete that style registration:

add_action( 'init', 'remove_my_style_stylesheet', 99 );

function remove_my_style_stylesheet() {

	wp_deregister_style( 'my_style' );
}

Notes

Changelog

Since 2.1.0 Introduced.

wp_deregister_style() code WP 6.5.2

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

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