wp_insert_post_data filters post data just before it is inserted into the database. Documentation
add_filter('wp_insert_post_data', 'schedule_post_on_publish', '99');
function schedule_post_on_publish($data) {
$post_type = "event"; // Replace event with exact slug of your custom post type
if ( $data['post_type'] == $post_type AND $data['post_status'] == 'publish' ) {
$data['post_status'] = 'future';
}
return $data;
}
This may help.
Related Posts:
- Is it possible to have more “levels” of draft/published statuses?
- What is a “protected” post status?
- how to assign a status/mark to post?
- Why doesn’t wp_update_post() update the post_status field?
- register_post_status and show_in_admin_all_list
- Changing post status in one click
- How can I run custom function when post status is changed?
- WP_Post_List_Table::get_views – Have post counts account for filters?
- Creating/editing custom ‘post-state’
- Using arbitrary post status without registering it
- Get a list of ALL Statuses both registered and built-in
- Adding custom post status to visibility in publish meta box
- Changing post status
- Change scheduled posts to published
- Include Drafts or Future posts with count_user_posts?
- Remove ‘private’ and ‘pending review’ options from post status dropdown
- Can not get future_to_publish to work
- Which is the better way to get the status of a post?
- “Publish immediately” with custom post status
- Modify Post Status Arguments
- Additional page and post status types
- Add a simple JS Alert Box on Post Submission
- Function to change post status IF current user and post author are the same
- Schedule future post to custom post status instead of publish?
- Why does get_post_status display published when attachment is in trash?
- Workflow for attachments in WordPress
- how to transition to custom post status on post save
- How to change custom post type status when non-admin updates post?
- Custom post status filter links always show a count of all posts in the site with that status, not the logged in users count
- wordpress post status inquery
- Multiple Post Status
- retrieve post details in loop
- Any way to change post/page status when editing page?
- How to change post status from “draft” to “publish”?
- transition_post_status doesn’t work with bulk updates
- Submitted for Review back to a Draft page
- How to Add Custom Post Status in WordPress Admin
- Auto draft posts when scheduled date is reached
- Changing a post status name
- How to update post status to draft if user role is “pending’
- How to create posts with a specific date in bulk
- How to update page status from publish to draft and draft to publish
- How to change “Draft” string for status of custom post type to “Unavailable”?
- WP_Query by post ID doesn’t work if post is in custom post_status
- Custom Post Status not showing in Custom Post Type ALL view
- Bulk Update of Custom Post Type Post Status through SQL
- What action is called when drafts are saved?
- Automatically move pending posts after 30 days and, update the post date, when users update the posts
- Get images only if parent status is publish
- Create front end link to save post (or unpublish post) as draft
- How to untrash a post only if it was not a draft?
- Auto-generated posts not showing in backend (but being counted!)
- Change sticky status of posts from phpMyAdmin
- How can I set a Post’s default visibility to private and pending review checked
- How to limit post of custom post status?
- Change post status based on user role
- Pending status by default for a specific role
- Save author posts as in pending review – block users updating their posts
- Custom Status of Custom Post type need to EXCLUDE from Taxonomy pages
- Update postmeta Parent when post_status child change
- Wrong post_status notice after wp_insert_post_data
- Individual post. Meta_key, taxonomy or post status for separation?
- Allowing user to edit posts based on the post status
- WordPress action hooks related to scheduled posts not Fired
- Removing all post statuses from a Custom Post Type
- Admin – create custom post status and display above table
- Restrict edit, but allow preview for custom post status
- Show user info in a hovercard [closed]
- Do action for only switch status for publish_post
- Update status of all posts in a category
- why there are so many posts whoes post_type is revision? will these records waste too much database space?
- Programmatically change post visibility on save_post action return a 500
- Auto-change Post Status on First Page Load
- Remove Save Draft & Preview Buttions.. and also Statius: Draft & Visibility: Public
- wp_dropdown_pages : choose post status to list in dropdown
- Also show terms that are related to draft and pending posts
- WP_Query will not display draft posts
- Post Status Frontend Announcement
- Display amount of pending posts in back/front end
- Manually adding or updating CPT automatically sets post_status of future
- Change user role when user’s first post gets published
- Set Post Private if no linked Post Objects (ACF)
- Updating post status via rest api
- Transition_Post_Status hook not working properly
- edit.php all post not working
- If click on Save/Publish change Post Status to Pending Review instead Publish
- Hide or remove custom post status
- get_next_post() not working with future post status
- How to save post_status using action save_post?
- Why transition_post_type hook is called twice for the same post?
- Implement post status update as frontend news announcement
- Query for draft or scheduled post
- Override private status – Enable users to read private posts
- Change post status by custom fields
- Do anything on post_status change [duplicate]
- Comments not working (error not allowed) on posts with custom post status
- custom status in Woocommerce with database results
- transition_post_status hook, works – but not if the post is new
- WP CLI switching post status from publish to future not working?
- Implementing Soft Delete for Bulk Actions / Empty Trash