• I am migrating an existing WP to a new hosting service.

    I want to move the existing database “as is” to the new server.

    Once there I want to delete all posts before 01.01.2013.

    Besides running a delete sql query on the wp_posts table should I run a similar query on any other tables?

    The reason for the post-move cleanup is that I want the current database of 14,000+ post to remain intact for use under another domain name as a historical archive. This is a news aggregation website.

    TIA,

    One Old Vet

Viewing 7 replies - 1 through 7 (of 7 total)
  • You should also check .

    wp_postmeta (custom fields for each post, etc.)
    wp_term_relationships (categories / terms associated to a post)
    wp_comments (comments data)
    wp_commentmeta (comments data)

    Thread Starter oneoldvet

    (@oneoldvet)

    Rajesh,

    By “check” do You Mean I should run a SQL delete date-specific query on those tables as well?

    Since comments may cross over the date threshold I have set (01.01.2013) from the date of the original post, what field in those table should I run the query against?

    Thank you for your help.

    By “check” do You Mean I should run a SQL delete date-specific query on those tables as well?

    Ideally, you should perform an inter-table join (on the Post ID).
    Date-specific query to be applicable only on the wp_posts table.

    Thread Starter oneoldvet

    (@oneoldvet)

    I looked at the structures of:

    wp_postmeta
    wp_term_relationships
    wp_comments
    wp_commentmeta

    and only wp_postmeta has a field for post_id

    I also looked for plugin to accomplish this task and came up short on anything with enough history to assure me I couldn’t or wouldn’t screw this up.

    I am not familiar enough with the inner join syntax to put a query together that will safely delete posts based on a date range, specifically all posts before 01.01.2013

    I hate asking for someone to hold my hand on this but I’m flipping the switch on this move tomorrow night and am pressed for time.

    Help anyone?

    Thanks

    Try posting a job listing: https://jobs.wordpress.net/postajob.php

    Thread Starter oneoldvet

    (@oneoldvet)

    I’m an unpaid, and dare I say POOR blogger. I can’t afford to hire someone to create a sql query but thanks anyway.

    I also looked for plugin to accomplish this task and came up short on anything with enough history to assure me I couldn’t or wouldn’t screw this up.

    This is one situation where that actually doesn’t matter (and that’s only because you have a backup of your database).

    You have a complete database back up. This means that you can try any of these plugins, and test to see if they work without breaking stuff. If they work, then great. If they don’t work then you just restore your databse from your backup and try the next one. All it will take from you is a bit of time.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Deleting Posts by Date from WP Database’ is closed to new replies.