If you have the id of the posts, you can use wp_update_post
and change the post_date
.
foreach ($postId as $id) {
// random hour and time. You can also manually set these.
$h = rand(1, 23);
$i = rand(0, 59);
$newDate = array(
'ID' => $id,
'post_date' => "2013-12-19 $h:$i:59" // [ Y-m-d H:i:s ]
);
wp_update_post($newDate);
}
Related Posts:
- How to schedule multiple posts while adding new
- order posts by date like craigslist
- How to get the latest posting time of archived pages in WordPress?
- How to insert current date/time in the content of a post?
- How to get the date of a post in WordPress, so I could use it in a script?
- Automatically Updating Publish Date Bug
- How can I show many posts an author has per week?
- If modified on same day, show only time
- Prevent scheduled post being published if date/time is past current date/time
- Automatically add date to the auto generation of post slug
- How i can limit period of post publication?
- Changing default WP-Site creation date
- tribe_get_start_time displays the current date and time on other post types than tribe_events
- Get the most recently modified post date of most recently modified post
- How to show different timestamp
- Date is wrong on ‘all posts’ page
- Access last visit time to a post
- Post navigation using date
- Bulk update published posts date randomly using wp-cli?
- How do you update post date (year only) in a separate custom field?
- How to handle dates, trying to calculate time since a post
- date_query returning only the most recent post instead of the post published before today
- Difference between an archive and a page listing posts
- Post preview mechanism architecture
- Counting words in a post
- the_post_navigation seems to ignore same category filter
- How to programmatically create posts in wordpress?
- How to avoid duplicate posts on front page?
- is there a better way of combining this?
- Remove some articles from the list in WPAdmin for a user
- Pagination – Posting First Page Content
- get_permalink executes link without https
- How to show featured image in custom post type dashboard post page
- Notification to Admin or Author upon new post [duplicate]
- Displaying a widget only on long posts (over X characters)
- Remove permalink from images when inserting into post
- How to create a load more post entries like Twitter?
- WordPress blog post cloned and stolen?
- Is there a way to apply WordPress categories at the block level?
- Featured Image uploaded, attached and set but only appearing in the media library
- Insert woocommerce products programmatically with featured image and gallery
- wp-cli post create & media import issues
- Getting the current author (it has changed) of a post, not the original author
- Hightlight unread posts or new posts since last login
- Editing 375 posts simultaneously? Maybe from the database?
- Why does WP_Post not contain its permalink?
- How Do I Get My Post Tags to Alphabetize?
- What happens if I delete all the rows that represents a post revision from the posts table into WordPress database?
- Remove Featured Image & All Media Uploaded to the Post
- How show categories in admin and get that selected to show posts in index
- Transition from Draft to Scheduled Post with wp_update_post
- Display related post by tag name of current post
- Get posts with multiple categories
- Do not show children of a category
- Posts showing […] in it
- Custom Permalink Structure for Pages & Posts
- Getting a “404 Not Found” error when “Preview Changes” is clicked
- Display a list of users who have viewed the post you are viewing
- How to give classname to post if post has no content?
- wp_update_post creating revisions instead of updating the post
- Where exactly should I hook in order to change the post’s ID before insertion in the database?
- Display selected categories onto post page
- WordPress pagination and Post Navigation not working on home page
- Audio post format with Advanced Custom Fields
- Would a “hub” page work better as a page or a post?
- Some doubts about how the loop work (trying debugging it)
- Retrieve data from post meta meta_key having ‘_product_fq_image’ while having author_id and post type is PRODUCT
- Get Users Post ID
- add_rewrite_rule and template redirect not working
- adding my posts (author posts) in menu
- How to separate each individual blog post?
- Allowing Users to Register Themselves and Post : Does WordPerss Handle these Problems?
- get parent fields title, content excerpt etc
- DEL media from the post but keep my featured image or post
- Group first, 2nd, 3rd, etc posts by category terms
- exclude particular category in api
- wp_trash_post() duplicates post to trash
- How to backup WP blog posts to computer, not new site
- Make categories appear random
- Add view to admin menu to filter for specific criteria ( If post is child of specific Parent )
- Create Posts from API response without duplicates
- I want to change the WordPress comments file
- How to find the edit link of the WordPress Post from the URL
- Get posts from category from custom query
- Can I Paginate Post after every 25 tag?
- How to show posts ordered by random [duplicate]
- Query posts from newest category
- Trim excerpt to first paragraph
- WordPress loop uses unmodified posts array, why?
- Create new post on user registration
- Ajax – Post Categories and Load More
- Skip posts, but keep posts per page
- how to add a facebook page latest posts into my wordpress site
- Displaying categories items among posts
- Display only posts with comments
- Display ONLY Latest Post From Several Categories
- WordPress Page Column Problem [closed]
- If meta_key exists then don’t select this post?
- Is there a block to print post link standalone in a block theme?
- Output number of WordPress posts remaining until a post milestone is reached