WordPress.org

Ready to get started?Download WordPress

Forums

How to mass edit post date publish? (9 posts)

  1. freakable
    Member
    Posted 1 year ago #

    I want to export about 1000 post to my wordpress blog. How can i mass edit them, to publish from:
    2013-06-24
    to
    2014-06-24

    I want to publish posts about 3 per day, not 1000 per. It's even possible to do?

  2. CrouchingBruin
    Member
    Posted 1 year ago #

    It's possible. It would take a bit of time.

    You're trying to export them from another database into your WP blog? How big are your posts? Here's how I would do it:

    1. Write a CSV file using the data from the existing database.
    2. Import the CSV file into a spreadsheet.
    3. Sort the data in the order you want the posts to appear.
    4. For the first row, set the post_date to 2013-06-24 01:00.
    5. In the next row, create a forumla in the post_date column, adding 8 hours to the previous row.
    6. Copy that formula down the rest of the rows. That should separate each row by eight hours, which means three posts per day.
    7. Write a spreadsheet macro that creates an SQL script that you can import into your WordPress wp_posts table.

    You'll have to examine the wp_posts table to make sure you have content for all of the fields that it's expecting. It looks like ID is an auto-incrementing field so you won't need to worry about that.
    Make a backup of wp_posts before you do anything like that, of course.

  3. freakable
    Member
    Posted 1 year ago #

    I will export post from sql file. There is no plugin to randomize publish date post?

  4. ianhaycox
    Member
    Posted 1 year ago #

    I've not tried it, but maybe some SQL to randomize the publish date after importing the posts. E.g.

    UPDATE wp_posts SET post_date = FROM_UNIXTIME(
      UNIX_TIMESTAMP('2013-06-24 12:00:00') + FLOOR(0 + (RAND() * 31557600)))
      WHERE post_status = 'publish';

    Basically starting from 2013-06-24 ish - add a random number of seconds up to a year in advance. 31557600 = seconds in a year (ish).

    You may want to also update post_date_gmt and the post_modified* columns as well.

    Ian.

  5. freakable
    Member
    Posted 1 year ago #

    Ok, date changed about to 2014-01-04

    But post is still published, i want to Schedule the post. I mean, if post date is 2014-01-04, so to 2014-01-04 day post is planned, after that date is published.

  6. bcworkz
    Member
    Posted 1 year ago #

    You need to set the status field as 'future'

  7. freakable
    Member
    Posted 1 year ago #

    But where? In my site in post ?
    It will be hard to set the status as future to 1000 post

  8. CrouchingBruin
    Member
    Posted 1 year ago #

    Future is not an option in the post's Status field.

    Theoretically, as long as the date is a date in the future, the post will not appear until after the published date and time is reached. Are you developing on a local server, and is the local server date correct? Are you sure the date and time are correct in the WordPress table?

  9. bcworkz
    Member
    Posted 1 year ago #

    freakable, I was assuming you would use a mySQL query to change the status column of all posts in the table with future publish dates to 'future' en masse.

    As CrouchingBruin stated, it is not an option in the post edit page. When a future date is set there, the status is set to future behind the scenes. But you can't do this manually for 1000 posts. A mySQL query is the only reasonable option.

    I'm unsure how to write a query to set the status to future only for those posts whose publish dates are in the future, but that is what you need to do.

Topic Closed

This topic has been closed to new replies.

About this Topic