add button to post edit page when post_status=publish

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.

Leave a Comment