/*
This restricts the custom post types'sponsors,' 'news,' and 'faqs' to the basic Gutenberg blocks mentioned.
*/
function wpdocs_allowed_post_type_blocks( $allowed_block_types, $editor_context ) {
if ( 'sponsors' === $editor_context->post->post_type ) {
return array(
'core/paragraph',
);
}
if ( 'news' === $editor_context->post->post_type ) {
return array(
'core/paragraph',
'core/list',
'core/image',
'core/buttons',
'core/quote',
);
}
if ( 'faqs' === $editor_context->post->post_type ) {
return array(
'core/paragraph',
'core/list',
'core/image',
'core/buttons',
);
}
return $blocks;
}
add_filter( 'allowed_block_types_all', 'wpdocs_allowed_post_type_blocks', 10, 2 );