Skip to content

Instantly share code, notes, and snippets.

@asha23
Forked from DavidPeralvarez/core-blocks.txt
Created June 17, 2019 10:46
Show Gist options
  • Save asha23/ec1e51e51d2ef38a49da4e79e033cc77 to your computer and use it in GitHub Desktop.
Save asha23/ec1e51e51d2ef38a49da4e79e033cc77 to your computer and use it in GitHub Desktop.
Gutenberg core blocks list
// Ú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
<?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