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 default block style for a specific block type
function unregister_default_block_style() {
    unregister_block_style( 'core/quote', 'large' );
}
add_action( 'init', 'unregister_default_block_style' );
// Example 2: Unregister a block style from a specific theme
function unregister_theme_block_style() {
    unregister_block_style( 'core/paragraph', 'light' );
}
add_action( 'after_setup_theme', 'unregister_theme_block_style' );
// Example 3: Unregister a block style conditionally based on user role
function unregister_block_style_based_on_role() {
    if ( current_user_can( 'editor' ) ) {
        unregister_block_style( 'core/image', 'rounded' );
    }
}
add_action( 'init', 'unregister_block_style_based_on_role' );