Skip to content

Instantly share code, notes, and snippets.

@WordPress-Handbuch
Last active January 16, 2019 11:05
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 WordPress-Handbuch/0397de53e5bd0935defed4fc8e3069ab to your computer and use it in GitHub Desktop.
Save WordPress-Handbuch/0397de53e5bd0935defed4fc8e3069ab to your computer and use it in GitHub Desktop.
WordPress 5/Gutenberg: Activate only specific block types
/**
* Allow only certain block types in Gutenberg
* Possible:
* core/list, core/quote, core/cover-image, core/paragraph, core/image, core/heading, core/gallery, core/audio, core/file, core/video
* core/freeform, core/html, core/code, core/preformatted, core/pullquote, core/table, core/verse
* core/button, core/text-columns, core/more, core/nextpage, core/separator, core/spacer
* core/shortcode, core/archives, core/categories, core/latest-comments, core/latest-posts
* core-embed/: twitter, youtube, facebook, Instagram, wordpress, soundcloud, spotify, flickr, vimeo, animoto, cloudup, collegehumor, dailymotion, funnyordie, hulu, imgur, issuu, kickstarter, meetup-com, mixcloud, photobucket, polldaddy, reddit, reverbnation, screencast, sribd, slideshare, smugmug, speaker, ted, tumblr, videopress, wordpress-tv
*/
function my_allowed_block_types( $allowed_blocks ) {
return array(
'core/image',
'core/paragraph',
'core/heading',
);
}
add_filter( 'allowed_block_types', 'my_allowed_block_types' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment