Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

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 );
    }    
} 
share|improve this answer
    
I think this will work. Thank you –  Manny Fleurmond Apr 14 '13 at 1:42
add comment

Your Answer

 
discard

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.