Remove the Publish metabox for custom post type

admin2025-06-03  2

This question already has answers here: How to HIDE everything in PUBLISH metabox except Move to Trash & PUBLISH button (2 answers) Closed 11 years ago.

I have a custom post type for events, and I wish to remove the Publish/Visibility options from the side as they are not relevant to the user.

Is there a way to do so?

This question already has answers here: How to HIDE everything in PUBLISH metabox except Move to Trash & PUBLISH button (2 answers) Closed 11 years ago.

I have a custom post type for events, and I wish to remove the Publish/Visibility options from the side as they are not relevant to the user.

Is there a way to do so?

Share Improve this question edited Dec 21, 2012 at 2:14 shea 5,6724 gold badges39 silver badges62 bronze badges asked Dec 21, 2012 at 2:01 KeithKeith 1931 gold badge2 silver badges7 bronze badges 2
  • 1 How are they not relevant? – shea Commented Dec 21, 2012 at 2:06
  • it will always be public and has dates the event will occur on set date ranges so no need to change the publish date either. – Keith Commented Dec 21, 2012 at 2:10
Add a comment  | 

1 Answer 1

Reset to default 10

WordPress provides the remove_meta_box() function exactly for this purpose:

add_action( 'admin_menu', function () {
    remove_meta_box( 'submitdiv', 'events', 'side' );
} );

The second parameter, events, will need to be replaced with the name of your custom post type.

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1748953839a315118.html

最新回复(0)