Opened 4 years ago
Last modified 4 years ago
#54288 new feature request
Argument for allowed blocks when registering a post type
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Future Release | Priority: | normal |
| Severity: | normal | Version: | |
| Component: | Editor | Keywords: | 2nd-opinion |
| Focuses: | Cc: |
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.
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.