Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Remove the default publish meta box
- *
- */
- add_action( 'admin_head', 'cs_admin_meta_boxes' );
- function cs_admin_meta_boxes(){
- remove_meta_box( 'submitdiv', 'cpt_name', 'side');
- }
- /* Add meta 'save' meta box
- *
- */
- add_action( 'add_meta_boxes', 'cs_meta_box_add' );
- function cs_meta_box_add(){
- add_meta_box( 'cs-save', 'Save', 'cs_meta_box_save', 'cpt_name', 'side', 'high' );
- }
- /* 'Save' meta box content
- *
- */
- function cs_meta_box_save(){
- echo get_submit_button( $text = 'Save', $type = 'primary', $name = 'submit', $wrap = true, $other_attributes = NULL );
- }
- /**
- * Sets the post status to published
- */
- add_filter( 'wp_insert_post_data', 'cs_force_published' );
- function cs_force_published( $post ) {
- if( in_array( $post[ 'post_type' ], array( 'cpt_name') ) ) {
- $post['post_status'] = 'publish';
- }
- return $post;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement