WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top


  • what hook can be used to add a custom button to the 'Publish' metabox on the 'Edit Post' admin page?

Use case

I have a hand-rolled custom post type called ash_newsletter. I want to add a button to the post.php?post={$post->ID}&action=edit admin page for this post type. The button will only appear after the post has been published. The button will only be clickable once. The button will be located in the "Publish" metabox.

My idea is that when the button is clicked, a script will check the current post status and will check that a post_meta, ash_already_ran==false. If both conditions pass, a function will be called that contacts another service. If the function returns true, 'ash_already_ran' will be updated to true.

share|improve this question

This will get you started;

add_action( 'post_submitbox_misc_actions', 'custom_button' );

function custom_button(){
        $html  = '<div id="major-publishing-actions" style="overflow:hidden">';
        $html .= '<div id="publishing-action">';
        $html .= '<input type="submit" accesskey="p" tabindex="5" value="Customize Me!" class="button-primary" id="custom" name="publish">';
        $html .= '</div>';
        $html .= '</div>';
        echo $html;

Adds a custom button to Publish Meta Box - example;

enter image description here

So far you still need to;

  • register the custom button on your custom post type only
  • write conditional check for to only show button when post has post_status of publish
  • write custom function to call your custom service

I need to go now, but do attempt to tackle the points above and post your results. I'll return tomorrow to see where you're at and if I anyone else can help further.

share|improve this answer
awesome! So I've got my button appearing only on my custom post and only when the post is published and doesn't have a value for 'already_done'. I've written and tested my service_call function. The only thing I'm still not sure of is what hook service_call() should be attached to. – dnagirl Oct 5 '12 at 18:11

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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