Advertisement
Guest User

Untitled

a guest
Nov 26th, 2014
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. /* Remove the default publish meta box
  2. *
  3. */
  4. add_action( 'admin_head', 'cs_admin_meta_boxes' );
  5. function cs_admin_meta_boxes(){
  6. remove_meta_box( 'submitdiv', 'cpt_name', 'side');
  7. }
  8.  
  9. /* Add meta 'save' meta box
  10. *
  11. */
  12. add_action( 'add_meta_boxes', 'cs_meta_box_add' );
  13. function cs_meta_box_add(){
  14. add_meta_box( 'cs-save', 'Save', 'cs_meta_box_save', 'cpt_name', 'side', 'high' );
  15. }
  16.  
  17.  
  18. /* 'Save' meta box content
  19. *
  20. */
  21. function cs_meta_box_save(){
  22. echo get_submit_button( $text = 'Save', $type = 'primary', $name = 'submit', $wrap = true, $other_attributes = NULL );
  23.  
  24. }
  25.  
  26.  
  27. /**
  28. * Sets the post status to published
  29. */
  30. add_filter( 'wp_insert_post_data', 'cs_force_published' );
  31. function cs_force_published( $post ) {
  32.  
  33. if( in_array( $post[ 'post_type' ], array( 'cpt_name') ) ) {
  34. $post['post_status'] = 'publish';
  35. }
  36. return $post;
  37.  
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement