• Okay WP community, I done messed up big time.

    I unintentionally deleted all of the media references in the DB to one of my sites (I mistakenly thought I was working on another dev site with a similar name).

    There is no backup (I know I know UTTER SHAME I thought it was a dev site…).

    I still have all of the files on FTP.

    How can I “refresh” all of the database links using the files on FTP? Will I have to “reattach” all of the media for each post??

    Help!

Viewing 1 replies (of 1 total)
  • Thread Starter jsally17

    (@jsally17)

    Here are the commands I used to delete the media files from the database:

    First I ran this:

    DELETE FROM wp_postmeta
    WHERE post_id IN
    (
    SELECT id
    FROM wp_posts
    WHERE post_type = 'attachment'
    )
    ;

    Then once executed, I ran this:

    DELETE FROM wp_posts WHERE post_type = 'attachment'

Viewing 1 replies (of 1 total)
  • The topic ‘How to restore media references in DB (I still have the files)’ is closed to new replies.