Opened 5 years ago
Last modified 5 years ago
#54288 new feature request
Argument for allowed blocks when registering a post type
| Reported by: | smeedijzeronline | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Future Release |
| Component: | Editor | Version: | |
| Severity: | normal | Keywords: | 2nd-opinion |
| Cc: | Focuses: |
Description
Add argument for allowed blocks when registering a post type:
function wporg_custom_post_type() {
register_post_type('wporg_product',
array(
'labels' => array(
'name' => __('Products', 'textdomain'),
'singular_name' => __('Product', 'textdomain'),
),
'public' => true,
'has_archive' => true,
'allowed_blocks' => array(
'core/image',
'core/paragraph',
'core/heading',
'core/list',
'core/embed',
'core/missing',
'core/button',
'core/buttons',
),
)
);
}
add_action('init', 'wporg_custom_post_type');
Change History (2)
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Hello @smeedijzeronline, welcome to WordPress Trac and thank you for opening this ticket,
While this proposal would indeed need a WordPress core change, we'll also need a Gutenberg issue on the GitHub repository, and it's probably better to move the discussion on the Gutenberg repository.
https://github.com/WordPress/gutenberg/issues
Let's leave this ticket open since it will probably need some work if the proposal is accepted on the Gutenberg project.