Schedule future post to custom post status instead of publish?

I’ve been doing some research into custom post statuses and scheduling posts and I had a question: I was wondering if it were possible to schedule a post to got from future to a custom post status instead of publish? Main reason I’m asking is that I have a custom post type called stream and I’ve created a custom publish meta box that allows a user to select 2 post statuses: online and offline. I’m trying to make it so that if I set a future date, the stream post will transition to online instead of publish as it normally would.

My train of thought would be to hijack via filter the post status to automatically transition to online whenever WordPress tries to set it to publish. Would that be a viable option?

Related posts

Leave a Reply

1 comment

  1. Here is one idea:

    You could try to use the future_to_publish action to change the post status:

    add_action('future_to_publish', 'set_status_online_wpse_95701'); 
    function set_status_online_wpse_95701( $post ) { 
        if ( $post && $post->post_type==="stream"){
           $post->post_status="online"; // change the post_status
           wp_update_post( $post );
        }    
    }