最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

Remove the Publish metabox for custom post type

matteradmin10PV0评论
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.

Articles related to this article

Post a comment

comment list (0)

  1. No comments so far