-
-
Save giorgioriccardi/71f97eeb1646314386f14043cf0e8124 to your computer and use it in GitHub Desktop.
Gutenberg core blocks list
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Útil para filtros de Gutenberg como "allowed_block_types" | |
archives | |
audio | |
button | |
categories | |
code | |
column | |
columns | |
coverImage | |
embed | |
file | |
freeform | |
gallery | |
heading | |
html | |
image | |
latestComments | |
latestPosts | |
list | |
more | |
nextpage | |
paragraph | |
preformatted | |
pullquote | |
quote | |
reusableBlock | |
separator | |
shortcode | |
spacer | |
subhead | |
table | |
textColumns | |
verse | |
video |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Filtro para limitar el tipo de bloques que admite un CPT 'libro'. | |
function scv_allowed_block_types( $allowed_block_types, $post ) { | |
if ( $post->post_type === 'libro' ) { | |
return array( | |
'core/paragraph', | |
'core/image', | |
'core/list' | |
); | |
} | |
return $allowed_block_types; | |
} | |
add_filter( 'allowed_block_types', 'scv_allowed_block_types', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Since WordPress changed the Embed blocks to all variations of the
core/embed
block they are now no longer being allowed individually by using theallowed_block_types()
hook in previous versions of WP.There is a working solution here, that works for me only if Gutenberg is installed as plugin (probably because some filters are not yet into WP core 5.6):
https://wordpress.stackexchange.com/questions/379612/how-to-remove-the-core-embed-blocks-in-wordpress-5-6/380977#380977