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.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.