I found my answer while searching over other stackoverflow answers below is the code what I’ve added.
$postdate = date('Y-m-d H:i:s',strtotime('+20 minutes'));
$postdate_gmt = gmdate('Y-m-d H:i:s',strtotime($postdate));
$post = array(
'post_date_gmt' => $postdate_gmt,
'post_date' => $postdate,
'edit_date' => 'true'
);
Related Posts:
- Schedule Posts to Publish from Dates/Times Pre-Set by Admin
- Scheduled posts: set default time?
- How to create pages that do change or expire after a specified amount of time?
- How to resolve scheduled posts that say “Missed Schedule”
- How to Display Details page of future (scheduled) posts
- How to schedule autopost publishing at each 60 minutes?
- User unable to see a scheduled post via the url?
- How can I show my scheduled posts in Google Calendar?
- Posts miss schedule, no notification (3.7.1)
- Does WordPress provide an API for scheduling posts?
- Publish scheduled pages right away in WordPress
- Remove “Edit Link” next to “Publish immediatley” when adding a new post
- Can’t open scheduled posts
- How to schedulle a post to be unpublished?
- Unable to run custom CRON jobs on aws server
- Scheduling wordpress posts
- Scheduled posts are being published immediately
- Is it possible to schedule a page edit to go live on a certain date?
- How can I delay the publishing of a page or post?
- How to prevent posts from being published too close to each other?
- Why doesn’t wp_update_post() update the post_status field?
- Better handling of WP-CRON server load abuse
- Immediately published posts are scheduled and published 2 hours later
- Make future posts visible to the public—not just within WP_Query
- What is considered the post’s creation date for wp_insert_post?
- Missed scheduled WordPress
- All WordPress scheduled posts are being published immediately
- Scheduled Posts and wp-cron – Why don’t scheduled posts publish if too old?
- wp_insert_post to schedule a post – but nothing happens?
- Unschedule a post
- Change scheduled posts to published
- Scheduling posts in database
- Allow Facebook to preview posts before published
- Update content of multiple pages/posts at once?
- Feedburner doesn’t update when “scheduled post” publishes
- Error trying to publish immediately. Post status = future (Missed schedule error)
- Disabled wp-cron, set up system cron but still have missed schedule posts
- How to code schedule / cron job
- timestamp and scheduled post irregularities
- Set the publication date independent of the scheduled publication date
- Display only one post each WEEK
- Schedule Page to Menu [duplicate]
- Schedule future post to custom post status instead of publish?
- Allow non-logged in users to see a future post after clicking on a list of future posts
- Scheduling update post daily
- How do I change the permalink of a scheduled post so that it can be linked to?
- How to switch wordpress post status between publish and schedule in MySQL?
- Update Modified date when scheduled posts get published
- WordPress action hooks related to scheduled posts not Fired
- WordPress automatic publish: is there a timeout when WordPress won’t publish anymore?
- How to create a WP Cron hooks based on schedules from Advanced cron manager plugin?
- How to fix missing function in wp-cron?
- Problems with cron
- permalink %year% of pre-written posts to be published next year, in the mysterious future (*)
- “Missed schedule” posting bug
- Return scheduled posts with WP REST API
- How to restrict an author scheduling their post date to a maximum X days ahead from the current date
- How do I publish portfolio items with a future date?
- Sort scheduled posts in ascending order by default
- Show scheduled posts in loop (but don’t link to them)?
- Include future posts in tags and in search
- Schedule an action callback
- Add scheduled page or post in the menu section on back-end
- Is there a way to schedule changes to a page?
- How to export custom post type with ACF to individual file with automation?
- Scheduling publish of a new version of existing page results in 404
- Comments on future posts
- Include scheduled ( future ) posts in WordPress post navigation ( previous_post_link, next_post_link )
- How to schedule categories?
- Scheduling posts via sql
- Query to view scheduled or draft post
- Setting Post Date Returning “Notice: A non well formed numeric value encountered”
- What action to use for when a post is saved / published, with a caveat
- Specific Days, Specific image on Front Page
- rewrite_rules problem
- Include “Scheduled” (“Future”) Posts in WordPress Post Navigation ( previous_post_link, next_post_link ) for a Specific Custom Post Type
- Adding $args to wp_schedule_event() causes hook to add infinitely to WP Cron
- Show custom content when loop or wp query reaches specific time?
- post_exists stops working in a scheduled event
- How to publish post to individual based on date
- Automatically delete posts one by one depending on published time
- What am I doing wrong creating post draft via wp-cron? (wp_schedule_event & wp_insert_post)
- Scheduling a post using publish date from a custom field. Resulting post is set as published in the future instead of scheduled
- Create blog post from external source and set publication date
- Schedule reminder at exact time
- How to Create movie schedule by custom post type query
- Auto draft posts when scheduled date is reached
- suffix title with “EXPIRED” when scheduled post has reached it’s published date
- Is it normal for a scheduled post to say “Missed Schedule”
- How to customize ‘recurrance’ of’ wp_schedule_event’?
- How to Insert data with wp cron
- Posted posts scheduling to unhide for new members
- How to prevent people from seeing an attachment to a scheduled post that’s released in future?
- Display “Today” Instead of Date for Pubslished Posts
- Make future posts visible to the public—not just within WP_Query
- Force Publish Future (Scheduled) Posts Immediately [duplicate]
- has_post_thumbnail() Returns False on Scheduled Posts
- Is There a Way to Schedule URL to Content Updates?
- Cron job for wp_cron.php running but not publishing scheduled posts
- Running a function using Crown WordPress on one day a week, for example, Mondays of every week