I have similar problem as described in How to trap “Publish” button to check for meta box validation?
Answer there is to hook into save_post
and change post type. How can I do it?
I try to use wp_transition_post_status
but it doesn’t work for me…
function myHook( $post_ID, $post )
{
wp_transition_post_status('pending', $post->post_status, $post );
}
add_action( 'save_post', 'myHook', 10, 2 );
Edit: I have clear wordpress installation without any plugins, additional code and similar
You get the full post object as a second parameter on
save_post
. Use it to change the status just like the following code.See this answer for a list of post statuses.