I think I found the solution:
add_filter('wp_insert_post_data','reset_post_date',99,2);
function reset_post_date($data,$postarr) {
//update post time on status change
$data['post_date'] = $data['post_modified'];
$data['post_date_gmt'] = $data['post_modified_gmt'];
//also update title and add the current date to title
$data['post_title'] = 'Your Default Title - '. current_time ( 'm-d-Y' );
//also update the slug of the post for the URL
$data['post_name'] = wp_unique_post_slug( sanitize_title( $data['post_title'] ), $postarr['ID'], $data['post_status'], $data['post_type'], $data['post_parent'] );
return $data;
}
Related Posts:
- Replace image name on upload to the new post name on front-end form
- Edit the post title from the frontend
- Change modified date to current date when title updated automatically
- how to show current date on post title which should be auto update in every day
- How to change the case of all post titles to “Title Case”
- How to get post creation date?
- Use category base slug in posts’ permalink
- using wp_update_post on save_post
- Post slugs and images cannot have same name?
- Set Post Title to Read-only and Disable Permalink Slug Editor in Gutenberg
- Change the Slug of Post Type post to baseurl/post/%postname%
- Get title of post without using the_title();
- How to put last edited entry on top of the blog-post list?
- Query posts from current year
- How to control which category will be picked for the slug of a post?
- Change slug with custom field
- Update existing post dates to random dates
- featuring old articles without messing up with the archive
- Human Time Diff, change mins to minutes
- How can I display a specific user’s first published post?
- How do I get the slug of a custom taxonomy category of a post?
- Fetch posts from current week (Sunday to Saturday)
- Testing for post title in ‘if/else’ statement returns no content
- get_post_field – Title without paragraph
- Add Category name to Post Title (h1)
- Sorting posts alphabetical that have single digits
- How to set post expiration date and time and move the page to archive after expiration [closed]
- How to get posts by multiple post slugs? [duplicate]
- Define a name to the posts slug
- Bulk update post slugs through database
- Get random posts between specific dates / of specific age
- How to display following posts titles in separate div’s on a separate webpage
- Blog Posts not showing title
- How to Orderby Comments by post title?
- If modified on same day, show only time
- WordPress not opening posts with only numbers if permalink is post_name
- Automatically add date to the auto generation of post slug
- How to handle broken links created by permalink/slug changes?
- Visting slug for ‘post’ post type shows 404 not archive?
- Remove Custom Post Type Slug and add Custom Taxonomy to Permalink Structure?
- sql select for post_title and a term name
- date issue with category post retrival
- WordPress is replacing double minus signs in Post Title, how to disable it?
- Images inside post title
- Loop doesn’t show title of second post and posts thereafter
- Disable WordPress Archive Conflict Check
- How To capitalize The First Letter Of Every Word In The Post Title
- How to show show the Second page title in the page
- WordPress custom post type with folder structure in slug
- How to get posts published on the latest date?
- Blog post not showing title
- How can I remove the first two words and shorten get_the_title()
- How to style archive post titles… but only those posts who have comments?
- my post slug gets really long and I can’t change it
- Image behind the post’s title
- Show custom post with custom categories with specific slug
- Change Post Title For Specific Category
- Modify this line to give alternate format date?
- How to remove “» (title of post or page)”?
- Post: how to set created date after post has been published [closed]
- wp_query if have posts show date but not in loop
- Microformats in a single post – layout conflict
- post type slug vs page slug
- Getting an extra post’s meta data?
- Plotting posts on a graph
- Order posts by date
- Changing The Default Header POST Title and Description text by category in wordpress
- My website is showing today’s date instead of published date since db migration to a new wordpress
- How can I change the date format of the revision list?
- Get post slug and match with menu item slug to change css
- Post title not displaying as recorded in the wp_posts table
- How can get the last post date of the user?
- How to get post creation date?
- How to 301 redirect from url with post id to permalink with post name (slug)?
- Create/Set Category as Title of Post
- long-title posts do not want published
- Please I want to prefix my WP posts title according to each category
- How do i search post by jquery datepicker?
- Post title spoiler how?
- Word /blog/ in slug post, problems in CPT. Solutions?
- 2 Domains, Same Content, Different Titles?
- My post permalinks are always the same
- Compare date of user’s last posts
- Adding post date to ACF field
- Hide title in Merlin Theme on posts and pages only
- How can I set and update the the_date according to a custom field of the post
- Query post for today, if no post get the previous one
- Set post beginning date and final date
- Post as frontpage – avoid duplicate content
- How to get all post titles starting with numbers and symbols?
- Custom Post Title as search term
- Last three posts not being put in order by date. How to fix this?
- Is there a way to separate wordpress titles from their posts?
- How to display a certain template element only for posts published within certain time range?
- Single post pagination
- How remove “recent comments” title without modifying code? [closed]
- How to remove a date from wordpress post
- how show post date for specific post?
- How to change Post title background size?
- Exclude posts by date – related post