Skip to content

Instantly share code, notes, and snippets.

@digamber89
Created May 17, 2023 11:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save digamber89/447c1deab44fb937b8d819e4597c6442 to your computer and use it in GitHub Desktop.
Save digamber89/447c1deab44fb937b8d819e4597c6442 to your computer and use it in GitHub Desktop.
<?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