2

I'm aware there is quite a lot of flexibility to add to the various editor components in the block editor using SlotFills this is useful when you want to add functionality. However my question is about removing functionality.

I'd really like to remove one or more of the components below already added into the PluginPostStatusInfoSlot

Given there aren't inbuilt filters or hooks into this at the moment - I'm wondering if I'm missing something React-y here that I can use. jQuery is a no-no.

How it's added in the core:

const PostStatus = ( { isOpened, onTogglePanel } ) => (
    <PanelBody
        className="edit-post-post-status"
        title={ __( 'Status & visibility' ) }
        opened={ isOpened }
        onToggle={ onTogglePanel }
    >
        <PluginPostStatusInfo.Slot>
            { ( fills ) => (
                <Fragment>
                    <PostVisibility />
                    <PostSchedule />
                    <PostFormat />
                    <PostSticky />
                    <PostPendingStatus />
                    <PostAuthor />
                    { fills }
                    <PostTrash />
                </Fragment>
            ) }
        </PluginPostStatusInfo.Slot>
    </PanelBody>
);

Other plugins seem to remove the whole panel and rebuild this if they want to remove components - but that doesn't seem future friendly to any WP updates.

Any and all help appreciated.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.