• I have several custom post status’s registered on my site but the problem i have is that within a post when i select the custom status from the dropdown it will only at first allow me to “Publish” the content as a way of saving. One this is clicked the status returned to published and i have to re-select the status and click the “Update” button which has now replaced the published button. This goes around and around as after clicking update the button is again replaced with “Update”!

    What im looking for is to have it so i have just “update” as a button that saves the projects status for me instead of forcing it as published every other save.

    Here is how i am registering the post status:

    function project_custom_status_awaiting_payment(){
         register_post_status( 'awaiting_payment', array(
              'label'                     => _x( 'Invoiced & Awaiting Payment', 'project' ),
              'public'                    => true,
              'show_in_admin_all_list'    => true,
              'show_in_admin_status_list' => true,
              'label_count'               => _n_noop( 'Invoiced & Awaiting Payment <span class="count">(%s)</span>', 'Invoiced & Awaiting Payment <span class="count">(%s)</span>' )
         ) );
    }
    add_action( 'init', 'project_custom_status_awaiting_payment' );
    
    Here is how i am adding it to the status dropdown list within the post:
    function append_post_status_list(){
         global $post;	global $aCustomPostStatus;
    		echo '<script>jQuery(document).ready(function($){';
    		  echo  '$("#save-action").hide();';
    			$complete = '';
    			$label = '';
    			if($post->post_status == 'awaiting_payment'){
    				$complete = ' selected=\"selected\"';
    				$label = '<span id=\"post-status-display\"> '.$aCustomPostStatus[$post->post_status].'</span>';
    			}
    
    		  echo '
    			   $("select#post_status").append("<option value=\"awaiting_payment\" '.$complete.'>'.$sLabel.'</option>");
    			   $(".misc-pub-section label").append("'.$label.'");';
    		echo '  });</script>';
    
    }
    add_action('admin_footer-post.php', 'append_post_status_list');

    [Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]

The topic ‘Custom Post status always saving as published’ is closed to new replies.