Skip to content
This repository has been archived by the owner on Oct 21, 2019. It is now read-only.

remove_meta_box #4

Open
braders opened this issue Apr 30, 2018 · 3 comments
Open

remove_meta_box #4

braders opened this issue Apr 30, 2018 · 3 comments

Comments

@braders
Copy link

braders commented Apr 30, 2018

In the current editor it is possible to suppress also every part of the interface through the use of remove_metabox(). In the new editor, metaboxes are a legacy concept, and document settings are implemented in alternative ways.

Specific examples

  1. Suppressing post-specific content from admin-only custom post types (e.g. a redirect CPT, which does not require an author, page attributes etc.)

  2. In the current editor, it is possible to remove a core metabox, and replace it with a custom implementation. For example, a common use-case it to remove taxonomy metaboxes in order to provide a new interface which uses radio buttons (instead of checkboxes). e.g. https://plugins.trac.wordpress.org/browser/radio-buttons-for-taxonomies

Gutenburg alternative

There appears to be no ideal alternative in Gutenburg. I have seen it suggested that non-content posts, (such as the redirect CPT example) should continue to use the old editor, but this does seem to be limiting the usefulness of the new editor.

It may be possible to hide Document sidebar sections with CSS, but this is going to be a brittle solution unsuited to most use-cases.

@danielbachhuber
Copy link
Owner

  1. Suppressing post-specific content from admin-only custom post types (e.g. a redirect CPT, which does not require an author, page attributes etc.)

To speak to these points specifically:

  1. The author select UI only appears when post_type_supports( $post_type, 'author' ).
  2. Similarly, page attributes are only displayed if the post type supports page-attributes.

You can remove the UI for either from Gutenberg by removing post type support for that feature.

  1. In the current editor, it is possible to remove a core metabox, and replace it with a custom implementation. For example, a common use-case it to remove taxonomy metaboxes in order to provide a new interface which uses radio buttons (instead of checkboxes). e.g.

Correct, there's no direct equivalent here.

Related WordPress/gutenberg#6694 (comment)

@danielbachhuber
Copy link
Owner

Related WordPress/gutenberg#6912

@abursill
Copy link

This totally sucks I have sspent hours trying to remove the

function my_remove_meta_boxes() { remove_meta_box('postimagediv', 'brand', 'side'); } add_action( 'do_meta_boxes', 'my_remove_meta_boxes' );

I need to move it into the content below which I managed to do but it now conflicts with the original one I can not move. I do not want to have to write some hacky javascript to remove it.

You need to make some kind of simple rest function an array of items to not show in the rest ui.
When you make one please put a full working example of it. 90% of the things here on github are badly documented also.

I am no Wordpress expert. I actually hate it and find it much harder to work with than writing my own code.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants