• Skip to primary navigation
  • Skip to main content
OsomCode

OsomCode

Awesome code tutorials for WordPress and Genesis

  • Subscribe
  • My account
    • Edit profile
    • Favorites
    • Update credit card
  • Login

Limit the accessible blocks from the WordPress editor according to the post type

Discover in this tutorial how to limit the blocks available in the WordPress editor in a given Custom Post Type.

The block editor has more and more blocks. This is great as it offers more versatility when creating content, but it can also offer “too much to choose from” for some users.

There is an option to hide blocks that you do not want to be shown in the editor by clicking on the three dots at the top right and selecting: Tools > Block Manager.

WordPress-block-manager
WordPress block manager.

But this does not prevent the blocks from loading and being accessible from the manager in all post types.

With the arrival of the block editor and the Site Editing to WordPress, one of the concerns of designers and developers is that the end user has “too much” control over the design and can disrupt the work done by the professional.

In a previous tutorial I explained how to unregister native blocks from the WordPress editor but if what you want is to have a more granular control, depending on the post type, I recommend you follow the strategy below.

Limit the blocks displayed in the WordPress editor depending on the post type

Add the following code at the end of functions.php or in your functionality plugin:

To see this and another 1097 code snippets of this website, login or subscribe here.

In this code you use the allowed_block_types_all filter in conjunction with the post type context so that only certain blocks are shown depending on the CPT.

In the example above you get that in the “tutorial” CPT only the blocks are kept accessible:

  • 'core/heading': Header block
  • 'core/image': Image block
  • 'core/list': List block
  • 'core/paragraph': Paragraph block
  • 'core/columns': Columns block
  • 'core/buttons': Button block

But the idea is that you adjust the CPT and the blocks to what you are interested in.

Here you have the list with all the native WordPress blocks, categorized:

Text

  • Paragraph(core/paragraph)
  • Header(core/heading)
  • List (core/list)
  • Quote (core/quote)
  • Code(core/code)
  • Preformatted(core/preformatted)
  • Blockquote (core/pullquote)
  • Table (core/table)
  • Verse (core/verse)

Layout

  • Columns(core/columns)
  • Group(core/group)
  • More(core/more)
  • Page break (core/nextpage)
  • Separator (core/separator)
  • Spacer (core/spacer)
  • Buttons(core/buttons)
  • Text columns (deprecated)

Widgets

  • Shortcode(core/shortcode)
  • Files(core/archives)
  • Calendar (core/calendar)
  • Categories(core/categories)
  • Custom HTML(core/html)
  • Latest comments(core/latest-comments)
  • Latest posts(core/latest-posts)
  • RSS(core/rss)
  • Search(core/search)
  • Social icons(core/social-links)
  • Tag cloud(core/tag-cloud)

Embedded

  • Twitter(core-embed/twitter)
  • YouTube(core-embed/youtube)
  • Facebook(core-embed/facebook)
  • Instagram(core-embed/instagram)
  • WordPress(core-embed/wordpress)
  • SoundCloud(core-embed/soundcloud)
  • Spotify(core-embed/spotify)
  • Flickr(core-embed/flickr)
  • Vimeo(core-embed/vimeo)
  • Animoto(core-embed/animoto)
  • Cloudup(core-embed/cloudup)
  • Crowdsignal(core-embed/crowdsignal)
  • Dailymotion(core-embed/dailymotion)
  • Hulu(core-embed/hulu)
  • Imgur(core-embed/imgur)
  • Issuu(core-embed/issuu)
  • Kickstarter(core-embed/kickstarter)
  • Meetup.com(core-embed/meetup-com)
  • Mixcloud(core-embed/mixcloud)
  • Reddit(core-embed/reddit)
  • ReverbNation(core-embed/reverbnation)
  • Screencast(core-embed/screencast)
  • Scribd(core-embed/scribd)
  • Slideshare(core-embed/slideshare)
  • SmugMug(core-embed/smugmug)
  • Speaker Deck(core-embed/speaker-deck)
  • TED(core-embed/ted)
  • Tumblr(core-embed/tumblr)
  • Twitch(core-embed/twitch)
  • Videopress(core-embed/videopress)
  • WordPress.tv(core-embed/wordpress-tv)

Media

  • Image(core/image)
  • Gallery(core/gallery)
  • Audio(core/audio)
  • Cover(core/cover)
  • File(core/file)
  • Media and text(core/media-text)
  • Video(core/video)

Theme

  • Navigation(core/navigation)
  • Custom Link(core/navigation-link)
  • Home link(core/home-link)
  • Submenu(core/navigation-submenu)
  • Site Logo(core/site-logo)
  • Site Title (core/site-title)
  • Site Theme(core/site-tagline)
  • Query Loop(core/query)
  • Entry Template(core/post-template)
  • Entry Title(core/post-title)
  • Entry Excerpt(core/post-excerpt)
  • Entry Featured Image(core/post-featured-image)
  • Entry Content(core/post-content)
  • Entry Author(core/post-author)
  • Entry Author biography(core/post-author-biography)
  • Entry Author Name (core/post-author-name)
  • Entry Date(core/post-date)
  • Entry Modification Date(core/post-modified-date)
  • Entry Categories(core/post-terms with taxonomy:category)
  • Entry Tags(core/post-terms with taxonomy:post_tag)
  • Pagination(core/query-pagination)
  • Entry List(core/posts-list)
  • Avatar(core/avatar)
  • Entry Navigation Link(core/post-navigation-link)
  • Next Entry(core/post-navigation-link with direction:next)
  • Previous Entry(core/post-navigation-link with direction:previous)
  • Read More(core/read-more)
  • Comments(core/comments)
  • Comments Title(core/comments-title)
  • Comment Template(core/comment-template)
  • Comment Author Name (core/comment-author-name)
  • Comment Date(core/comment-date)
  • Comment Content(core/comment-content)
  • CommentReply-link (core/comment-reply-link)
  • CommentEdit-link (core/comment-edit-link)
  • Comment Pagination(core/comment-pagination)
  • Comment Entry Comment Form (core/post-comments-form)
  • Post Comment (deprecated)(core/post-comment)
  • Login/Logout (core/loginout)
  • Term Description(core/term-description)
  • Archive Title(core/archive-title)
  • Search Results Title (core/search-results-title)
  • Template Part(core/template-part)

You can see the updated list in the official documentation.

Conclusion

Now you know how to limit the blocks displayed in the block editor depending on the type of input.

In addition, you can combine it with this tutorial to give access to clients or collaborators so that they can modify the content but limiting it as you want.

Any questions? I read you in the comments.

And if you want to give me any suggestion for future tutorials, leave it in the contact form. Advantages of being a subscriber. 😉

Block Editor PHP WordPress

To leave read and make questions about this code, you can login or register.

  • About OsomCode
  • FAQ
  • Contact

Legal Notice · Privacy Policy · Cookie Policy · Terms and conditions
Copyright © 2026

close-icon

Lost your password?