Skip to content

Instantly share code, notes, and snippets.

@trembl
Forked from DavidPeralvarez/core-blocks.txt
Last active March 18, 2021 14:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trembl/078c13cee4741353ed1276db0d274266 to your computer and use it in GitHub Desktop.
Save trembl/078c13cee4741353ed1276db0d274266 to your computer and use it in GitHub Desktop.
Gutenberg core blocks list
// "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
function filter_block_types( $allowed_block_types, $post ) {
if ( $post->post_type === 'my_post_type' ) {
return array(
'core/paragraph',
'core/image',
'core/list'
);
}
return $allowed_block_types;
}
add_filter( 'allowed_block_types', 'filter_block_types', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment