Skip to content

Commit

Permalink
update gutenberg post status future to publish
Browse files Browse the repository at this point in the history
  • Loading branch information
shuvo7670 committed Aug 18, 2024
1 parent 0167b68 commit 0747bde
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,13 @@ function wpscp_rest_prepare($response, $post, $request){
if(!empty($request['meta']['prevent_future_post'])){
update_post_meta( $post->ID, 'prevent_future_post', $post->post_date );
$data = $response->get_data();
if( !empty( $data['status'] ) && $data['status'] == 'future' ) {
$post_data = array(
'ID' => $post->ID,
'post_status' => 'publish',
);
wp_update_post($post_data, true);
}
$data['status'] = 'publish';
$response->set_data($data);
}
Expand Down

0 comments on commit 0747bde

Please sign in to comment.