Skip to content

Instantly share code, notes, and snippets.

@priyabratary
Created August 18, 2018 14:18
Show Gist options
  • Save priyabratary/dc22cd68920098fcf60c4d1e747ed0e5 to your computer and use it in GitHub Desktop.
Save priyabratary/dc22cd68920098fcf60c4d1e747ed0e5 to your computer and use it in GitHub Desktop.
future post show now
// future post
function setup_future_hook() {
// Replace native future_post function with replacement
remove_action('future_post', '_future_post_hook');
add_filter( 'wp_insert_post_data', 'nacin_do_not_set_posts_to_future' );}
function nacin_do_not_set_posts_to_future( $data ) {
if ( $data['post_status'] == 'future' && $data['post_type'] == 'gallery' )
$data['post_status'] = 'publish';
return $data;
}
add_action('init', 'setup_future_hook');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment