• Hi Guys. I made a stupid error this afternoon because I’m tired and I just need to know if it’s possible to reverse it. Long story short, I performed an SQL query on the WP database (without backing it up before hand!!!) to change the URL of the images in the database to the new URL from the old one (dev site), but I inadvertently copied and pasted the wrong query and instead used this:

    UPDATE wp_postmeta SET meta_value = replace(meta_value,’https://www.oldurl’,’https://www.newurl’);

    (where the old url and the new url are the actual urls I needed to change.)
    Anyway, before I knew it the home page structure has now completely gone and I cannot log into the admin in the same browser I was using when it happened. I logged in via another browser as well as an incognito tab and the admin let me in, but when I went to edit the home page there is no data on that page to edit, it’s just gone.

    I tried reversing the query from new to old again, but it had no effect.

    What have I done and is there any way to get it back as it was again?

    I feel so stupid it’s not funny…

    Cheers guys

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz

    (@bcworkz)

    Don’t beat yourself up. Everyone makes mistakes they regret. It really sucks. None the less, lesson learned, time to move on. You can’t unring the bell. Inappropriately altering post meta shouldn’t impact logins or blank out page content. Even if it did, doing the exact reverse should have corrected it.

    Anyway, here we are, you have a problem with your site. First eliminate possible conflicts by deactivating all plugins and switching to the twentytwenty default theme. Clear your first browser’s cache and any cookies for both old and new domains. You should be able to login to the site again from the first browser.

    You must have set a static page for home in settings since you tried to edit it. You should be able to see and edit its content now. Some themes have a special home page template which doesn’t use page content, rather content is built dynamically from various sources. Twentytwenty doesn’t do this, so anything placed in the editor will appear on the page.

    Once you’ve confirmed basic functionality, restore your theme and plugins, one module at a time. When things break again, the last module is the cause. Maybe the devs of that module can help you patch things up.

    Next time you want to do a bulk URL change, I know you’ll make a backup. I also recommend you use the Better Search and Replace plugin to make changes. You have better control over what is changed, it doesn’t corrupt serialized data, and you can test drive the changes before committing to them.

    Thread Starter dashdesigns

    (@dashdesigns)

    Thank you so much bcworkz!
    You are right, I will not forget to backup next time.
    I think the issue was with the browser as you said. I removed all the cookies for the domain and everything seemed to work again (remembering I had reversed the query prior to what it was before).
    I really appreciate the time it would have taken for your detailed reply, I have learnt a lot today.
    Thanks again.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘wp_postmeta meta_value error’ is closed to new replies.