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

I have tied an action into a status change, which works on the backend. However,using a frontend button for updating post status does not trigger the action(http://wordpress.stackexchange.com/questions/17794/publish-pending-article-from-front-end-with-a-button), but it does update the post status.

So I have this button for updating a post from 'draft to rejected'

     function show_reject_button(){
       global $post;

        echo '<form name="front_end_reject" method="POST" action="">
            <input type="hidden" name="pid2" id="pid2" value="'.$post->ID.'">
            <input type="hidden" name="FE_REJECT" id="FE_REJECT" value="FE_REJECT">
            <input type="image" src="https://---.com/images/logo1/sreject.png" alt="reject" title="Reject this reservation" style="background: none !important; border:   none !important;">

    function change_post_status($post_id,$status){
      $current_post = get_post( $post_id, 'ARRAY_A' );
      $current_post['post_status'] = $status;

   if (isset($_POST['FE_REJECT']) && $_POST['FE_REJECT'] == 'FE_REJECT'){
     if (isset($_POST['pid2']) && !empty($_POST['pid2'])){

I'd like to thank Bainternet for that code.

I have the action of changing a post from draft to rejected tied into a function for changing some post meta.

      add_action ('draft_to_rejected', 'void_payment_hold' );   
      function void_payment_hold() {

     global $post;

      $type = get_post_type( $post->ID );

        if( $type == 'tribe_events' ){

            $order_id = get_post_meta($post->ID, 'order', TRUE);

            $current_hold = get_post_meta($order_id, 'hold', TRUE);

            $released_amount = get_post_meta($post->ID, 'amount', TRUE);

            $remaining_hold = $current_hold - $released_amount;

            __update_post_meta($order_id, 'hold', $remaining_hold);     



When I execute this on the backend it works, but when I update the post status with the button the function does not execute. Does anyone know why this may be happening?

Thanks for your time

share|improve this question
I also tried adding do_action("draft_to_rejected"); to the button but it didn't help – Kyle Nov 29 '12 at 21:48

Not exactly 'solved' -- I still do not know why wp_update_post() did not hit the transition of {old status}to{new status}

For my situation I simply added the below function to a unique instance of the button above. Not ideal, but hey it works.

share|improve this answer

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.