Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DigitalEssence/3cd077949c096eba137d70185fdcc337 to your computer and use it in GitHub Desktop.
Save DigitalEssence/3cd077949c096eba137d70185fdcc337 to your computer and use it in GitHub Desktop.
WordPress - PHP - Display posts dated in the future
//Display Future Posts
function de_prevent_future_type( $post_data ) {
if ( $post_data['post_status'] == 'future' && $post_data['post_type'] == 'post' )
/*Here I am checking post_type='post' , you may use different post type and if you want it
for all post type then remove "&& $post_data['post_type'] == 'post'"
*/
{
$post_data['post_status'] = 'publish';
}
return $post_data;
}
add_filter('wp_insert_post_data', 'de_prevent_future_type');
remove_action('future_post', '_future_post_hook');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment