Update:
Now that you've changed your question (and made my original answer look completely wrong!):
I haven't used the hook future_to_publish, but I have successfully used the transition_post_status
action (also referenced in the Codex page) to detect status changes.
Something similar to this has worked for me before:
add_action( 'transition_post_status', 'my_status_change', 10, 3 );
function my_status_change( $new_status, $old_status, $post ) {
if ($new_status=="future"$old_status=="future" && $old_status=="publish"$new_status=="publish"){
// do stuff....
}
}
I think you might have mixed up 2 hooks? The Codex refers to the following hooks:
- {old_status}_to _{new_status} Hook
An {old_status}to{new_status} action will execute when a post transitions from {old_status} to {new_status}.
In your case: future_to_publish (future_to_post won't work because post isn't a status
- {status}_{post_type} Hook
A {status}_{post_type} action will execute when a post of type {post_type} transitions to {status} from any other status.
In your case: This would be publish_post (I think this may be where you got them mixed up?)
I assume you only want future to publish transitions so try:
add_action( 'future_to_publish', 'future_publish' );