Random WordPress Function

Learn about a new WordPress function every day!


Function Signature:

unregister_block_style

Function Description:

Unregisters a block style.

Function Examples:

⚠️ Examples below are generated with GPT-3 once every hour. Do not take them too seriously.
Consider them as some extra input in your learning process - reason about them. Will it work? What could fail?
// Example 1: Unregister a block style for a specific block type
function my_unregister_block_styles() {
    unregister_block_style( 'core/quote', 'large' );
}
add_action( 'init', 'my_unregister_block_styles' );
// Example 2: Unregister multiple block styles for different block types
function my_unregister_block_styles() {
    unregister_block_style( 'core/quote', 'large' );
    unregister_block_style( 'core/image', 'rounded' );
}
add_action( 'init', 'my_unregister_block_styles' );
// Example 3: Avoid unregistering a non-existent block style
function my_unregister_block_styles() {
    unregister_block_style( 'core/quote', 'large' ); // This will not cause any issues if 'large' style is not registered
    unregister_block_style( 'core/image', 'rounded' ); // Make sure to check if the block style exists before unregistering
}
add_action( 'init', 'my_unregister_block_styles' );