Created
May 17, 2023 11:56
-
-
Save digamber89/447c1deab44fb937b8d819e4597c6442 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Blocks{ | |
public function __construct(){ | |
add_filter( 'allowed_block_types_all', [ $this, 'remove_template_blocks' ], 50, 2 ); | |
} | |
public function remove_template_blocks( $allowed_block_types, $block_editor_context ) { | |
if ( ! isset( $block_editor_context->name ) ) { | |
return $allowed_block_types; | |
} | |
if(is_array($allowed_block_types)){ | |
var_dump($allowed_block_types); die; | |
} | |
if(is_array($allowed_block_types) && $block_editor_context->name != 'core/edit-site'){ | |
$block_to_remove = 'vczapi/single-zoom-meeting'; | |
$index = array_search( $block_to_remove, $allowed_block_types ); | |
if ( $index !== false ) { | |
unset( $allowed_block_types[ $index ] ); | |
} | |
} | |
return $allowed_block_types; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment