Skip to content

Don't open block appender modal if only one block is allowed #19620

@ghost

Description

Hey,

I am only allowing one block on my page using this code:

add_filter('allowed_block_types', 'sp_allowed_block_types', 10, 2);

function sp_allowed_block_types($allowed_blocks, $post)
{

    if ($post->post_type === 'page' || $post->post_type === 'post') {
        $allowed_blocks = array(
            'sp/block',
        );
    }

    return $allowed_blocks;
}

It doesn't really make sense to allow the modal in this case, the appender icon should instead insert the only block that is available.

screencapture-spacepress-local-sp3-wp-admin-post-php-2020-01-14-12_24_51

Metadata

Metadata

Labels

[Feature] InserterThe main way to insert blocks using the + button in the editing interface[Type] BugAn existing feature does not function as intended

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions