you can automate this hour selection with the following code. take into account that this code also affect the date of a post created trough the API.
add_filter("wp_insert_post_data", function ($data, $postarr, $unsanitized_postarr, $update) {
if ( !$update
&& ("post" === $data["post_type"])
&& ("auto-draft" === $data["post_status"])
) {
$date = current_datetime()
->modify("tomorrow 08:00:00")
->format("Y-m-d H:i:s")
;
$data["post_date"] = $date;
}
return $data;
}, 10, 4);
what is also possible to do is to retrieve the last draft that you saved and then set the next draft date to the next day instead of tomorrow.
Related Posts:
- Missing feature image link function
- Get menu object from theme_location
- Displaying the number of updates available in the Admin area
- How to change the markup WordPress inserts for post images
- When tax_query used, results disappear (0 =1 produced)
- Targeting specific menu with wp_nav_menu_items
- wp_get_attachment_image returns different image size
- Limit the length of the Author Profile Biographical Text
- disable comments if array exists
- WordPress Change Post Templates,but not drop down, but Image selection
- wp_mail not running inside Cron
- Remove images from get_the_excerpt
- Remove “says” from comments
- Reuse variable in hook callback
- Remove product description from product archive page
- Logging in redirects to correct page but shows logged out content until forced refresh
- What is the criteria for pluggable functions?
- Can you use admin pages functionality on the frontend of your site
- How can I stop a function from encoding an entity?
- Theme-Config tab in admin Pannel?
- Display more recent and less recent posts in same category
- Increment price for Woocommerce Minicart [closed]
- Change woocommerce products weight varation based its product category or tags? [closed]
- Function to “Press Update Button” on all posts
- Change WP attachment name to postid during upload only for post type
- Overwrite Parent Theme add_image_size in Child Theme
- Completely disable RSS feeds on WP 5.5.2 and show a 404 page instead of die();
- Check if row exists before inserting
- Missing argument 2 for a custom function widgets_init
- How to target only the front page (not subsequent paginated pages) in theme/plugin?
- Removing the main link to Jetpack from the menu
- Defining a global array in functions.php?
- Get the 5 lastest Featured Posts from a category
- Set quantity of woocommerce product on page visit [closed]
- get_post_type() in in_array doesn’t work for some reason
- Is it possible to change any of the HTML/URL returned from the_category()
- Individually styling date month year [closed]
- How to remove set_post_thumbnail_size() in child themes?
- Activate small php condition at footer over page template
- How to insert custom widget in custom sidebar in theme activation?
- Writing functions in WordPress functions.php that don’t replace a WordPress core function
- How to load jQuery in the footer – nothing works for me
- HTTP_HOST changing in functions.php
- 404 redirect to previous category
- show first 3 thumbnails of posts in different sizes [closed]
- how to en-queue jQuery to load before the tag
- Getting custom image size URL in functions
- Can’t filter wp_get_attachment_link
- Impossible to call wordpress function inside an include?
- How to customize the_archive_title()? Cannot figure out how to change the value it produces [duplicate]
- Remove a category from a post when saving a new post
- Want to dequeue all the CSS and JS from /wp-content/uploads/xyz-folder
- Scripts not loading when using the wp_enqueue_scripts action
- is there a way to remove featured image from blog page and single page
- Include the post type before the title of search results
- Adding additional roles on registration
- add referrer to woo
- overwrite code snippet from parent to child theme
- Get Attachment Category Name
- Problem with custom function when I go back with the browser
- Insert a field with PREG_REPLACE – strange behaviour
- If no author posts, echo out some text
- How i can get the URL?
- Astra theme – cannot set short product description under the product title (product name)
- Add version # to wp_register_style function
- How to remove font awesome from loading in wp theme
- Gravity Forms – Custom Merge Tag Convert date_created to Local/WordPress Time?
- Add custom css file after plugin css with WordPress Child Theme functions.php
- Combine page types and Custom Taxonomy in a functions.php command
- Remove check boxes and its label from screen option for custom role
- Removing comment lines from all enqueued js files using a filter function
- Fatal error: Call to undefined function load_theme_textdomain() in /var/www/vhosts/61/151172/webspace/httpdocs/wp-includes/functions.php on line 5
- Remove clickable Link of WordPress Site Logo from Woocommerce Single Product page
- I have defined 2 text strings, how do I use them in my posts?
- Auto copy value from specific user meta field to another field
- Variable function names
- Route wordpress with template
- Change is_front_page() to is_page() to display ‘hero’ on entire site?
- Using a variable in name of dynamically-called helper function
- Function causes edit_post_link to link to the wrong post
- Getting back a blank WordPress site following functions code edit
- Insert menu into theme location depending on user logged in/out status
- custom COOKIE on custom page
- Add functionality to post editor
- Define an extra field for all pages (with no plugin?)
- Set thumbnail from URL, by grabbing image in functions.php
- admin-ajax.php nulls all php variables
- How to remove “login to reply” from individual comments [duplicate]
- How do I get my nav menu to show sub pages?
- How do I add e-mail subscription functionality
- Why functions metaboxes is causing White Screen in Admin [closed]
- Rename file after title , one small problem
- Adding function to function.php error 505 [closed]
- image_size with respect to aspect ratios
- Insert image between X number of posts but on specific paginated pages?
- wp_head not injecting css
- Call wordpress function through functions.php when pressing menu
- Include posts under a custom taxonomy in author.php
- is there a list of actions on WordPress
- Remove Actions/Filters added via Anonymous Functions