Support » Plugin: Gutenberg » Remove Core Meta Box

  • Resolved Mert D

    (@northeme)


    Hi,

    I’m using custom meta boxes for Featured Image and Page Attributes boxes. In order to use them, first I use the following function to remove core meta boxes :

    
    function custom_page_attributes() {
      remove_meta_box(
       'pageparentdiv',
       'page',
       'side'
      );
     
      remove_meta_box(
       'postimagediv',
       'page',
       'side'
      );
    
    }
    add_action( 'add_meta_boxes', 'custom_page_attributes' );
    

    It’s been working perfectly so far but it doesn’t work with Gutenberg. How can I remove core meta boxes?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Pascal Birchler

    (@swissspidy)

    What meta boxes are for the classic editor, panels are the equivalent in Gutenberg. These are completely different in terms of how they’re built and function under the hood.

    Panels are all added on the client side using JavaScript. There’s no PHP code that can be used to replace or remove them.

    While I’m not sure about the Page Attributes panel, the Featured Image panel can currently be replaced or removed using some JavaScript as outlined in https://github.com/danielbachhuber/gutenberg-migration-guide/blob/master/filter-admin-post-thumbnail-html.md.

    Please not that this is an area actively being worked on. There’s still an ongoing discussion about how to best support removing or replacing these panels. You con follow it at https://github.com/WordPress/gutenberg/issues/6533.

    Thread Starter Mert D

    (@northeme)

    I appreciate your reply Pascal. I’ll look into FeaturedImage function. Apparently it requires addition js function to remove / customize the box.

    Since PHP add_meta_box function is being still supported, removing core and other meta boxes will be good enough for Gutenberg in my opinion. But obviously it’ll require sending some custom JSON object. Hope there will be an easy solution to use current methods with Gutenberg.

    Thanks again!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Remove Core Meta Box’ is closed to new replies.