Make WordPress Core

Opened 3 months ago

Last modified 3 months ago

#54288 new feature request

Argument for allowed blocks when registering a post type

Reported by: smeedijzeronline 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)

#1 @audrasjb
3 months ago

  • Component changed from General to Editor
  • Version trunk deleted

#2 @audrasjb
3 months ago

  • Keywords 2nd-opinion added
  • Milestone changed from Awaiting Review to Future Release

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.

Note: See TracTickets for help on using tickets.