Last active
January 16, 2019 11:05
-
-
Save WordPress-Handbuch/0397de53e5bd0935defed4fc8e3069ab to your computer and use it in GitHub Desktop.
WordPress 5/Gutenberg: Activate only specific block types
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
/** | |
* 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