Support

Account

Home Forums Bug Reports acf_register_block and filter block_categories issue with 5.8.0 Reply To: acf_register_block and filter block_categories issue with 5.8.0

  • I’ve seen this option, thank you. But this way, I can’t remove the default block in pages.

    I’ve found this post which can be the solution:
    https://rudrastyh.com/gutenberg/remove-default-blocks.html

    But I have to list manually all of the block I want to use for each post type: can not exclude a whole category…

    add_filter( 'allowed_block_types', 'mlp_welcoop_allowed_block_types', 10, 2 );
     
    function mlp_welcoop_allowed_block_types( $allowed_blocks, $post ) {
     
    	if( $post->post_type === 'post' ) {
    		$allowed_blocks = array(
    			'core/shortcode'
    		);
    	} else {
    		$allowed_blocks = array(
    			'acf/header-default',
    			'acf/header-light'
    		);
    	}
     
    	return $allowed_blocks;
     
    }