2

We have two different custom user roles that have custom capabilities. What I'm trying to do is to add two custom visibility statuses that are visible from the publish meta box on the edit page.

enter image description here

I've got the post statues registered but I saw on the codex wiki that there is no easy way to add it to the list but I figured I would turn here to see if anyone has done something similar?

1 Answer 1

2

I also don't see a way to edit that form in that location, though there is a hook called post_submitbox_misc_actions near the bottom.

I strongly suggest that use that post_submitbox_misc_actions hook or add your own brand new meta_box to the page. There are potentially severe consequences to altering the default meta_boxes, especially that one.

However... if you must...

Remove that box:

function remove_taxonomies_submit_box() {
    remove_meta_box( 'submitdiv', 'book', 'side' );
}
add_action( 'add_meta_boxes_book' , 'remove_taxonomies_submit_box', 100 );

And add back a box of your own construction (Generic Example):

function add_altered_submit_box() {
  add_meta_box(
    'submitdiv', // id, used as the html id att
    __( 'Generic Title' ), // meta box title
    'generic_cb', // callback function, spits out the content
    'book', // post type or page. 
    'side', // context, where on the screen
    'high' // priority, where should this go in the context
  );
}
add_action( 'add_meta_boxes_book' , 'add_altered_submit_box', 101 );

The callback, of course, will be a near duplicate of the original submit box callback. The post type in those examples is 'book' that will need to be changed to match your post type.

1
  • I'm upvoting your answer for the elaborate it is!
    – jepser
    Commented Feb 27, 2015 at 5:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.