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’m having issues as well with multiple block categories and registering blocks to those categories. Whereas selecting multiple areas (CPT’s in this case), only one category is displaying at a time. And only one grouping of blocks will show (whichever is written first). The other I’m getting the Your site doesn't include support for 'acf/... block error. Not sure what the issue is there…

    At any rate, with your situation, you may want to attempt to merge the $categories and $welcoop_blocks arrays. Perhaps something like this may work for you:

    function ff_block_category( $categories, $post ) {
    
    	if ( $post->post_type == 'page' ) { 
    
    		$welcoop_blocks = array_merge(
    			$categories,
    			array(
    				array(
    					'slug' => 'headers',
    					'title' => __( 'WELCOOP Headers', 'mlp-admin' ),
    				)
    			)
    		);
    
    	} else {
    
    		return $categories;
    
    	}
    
    	return $welcoop_blocks;
    }
    add_filter( 'block_categories', 'ff_block_category', 10, 2);

    Hopefully that helps.