How to find and remove registered block styles from specific blocks

Block styles are great, they give users additional design options with a click of a button. These can be added by WordPress core, your active theme, and plugins that are activated on your site.

While having these styles ready to go can provide flexibility, sometimes you may not want them available for you or your clients. If this is the case, you can use the snippet of code below to remove all registered block styles from an array of defined blocks. Just copy and paste the code below into your functions.php file or a custom plugin.


 * Remove existing block styles
function metaphorcreations_remove_block_styles() {

  // Define an array of blocks
  $blocks = [

  // Find registered styles for each block and unregister
  if ( is_array( $blocks ) && count( $blocks ) > 0 ) {
    foreach ( $blocks as $block ) {
      $styles = WP_Block_Styles_Registry::get_instance()->get_registered_styles_for_block( $block );
      if ( is_array( $styles ) && count( $styles ) > 0 ) {
        foreach ( $styles as $style ) {
          unregister_block_style( $block, $style['name'] );
add_action( 'init', 'metaphorcreations_remove_block_styles', 99 );
Code language: HTML, XML (xml)