I am trying to: I exported a copy of mySQL database in .sql format. I do this for all my websites as a precaution. If corrupted or hacked, I can put back the backup. So something went wrong with Views, and I put the database backup.
Well, it worked, except all my views were corrupted. Took me 3 hours to redo all views by hand.
The views were there, except they were not working. When opening a views, it had NOT any custom post type selected. I couldn't work because it was not assigned to any CPT.
So first I had to reassign.
Then, it also lost ALL filters - and filter output. For example, if "child of" was selected in Filter. Then there just was nothing selected in filters in the imported database. I had to redo all filters.
Surprisingly, the Loop output was still there and OK.
I nedd to know: how to export the database and/or ho to reimport it without loosing all views? Does this mean I can never backup my site ?
But that's exactly what I did! I followed that tutorial!
And that didn't solve it!
I still have 255 places in wp_posts and wp_postmeta where my old localhost url still appears, even after I followed the instructions in the URL above.
- If I do a find-replace in SQL like UPDATE wp_posts SET post_content = replace(post_content, 'hidden link';, 'hidden link';);
Then all views are corrupted. They loose the assigned CPT.
- So I tried by hand, changing the URL in SQL guid or post_content: DOES THE SAME THING: CORRUPTS VIEWS
- So I dropped the tables and put back my backup version of the database that I had just done
THE VIEWS WERE CORRUPTED FROM THE IMPORT
I had to redo 65 views by hand.
This is driving me nuts.
- How an I change ALL instances of localwebsite to livewebsite in database ?
in works when using %{%'; at the end of SQL statement,
but does NOT replace all.
They are a lot of /\/\localwebsite/\/\ left. Changing by hand one by one still corrupts views.
This is bad:
Last night I created 6 views. They worked fine.
This morning I get an email from the client that they are not working.
I got check the website live, and the VIEWS ARE CORRUPTED
And I didn't touch anything!
They lost the associated Custom post Type again!
Now this is beyond moving the database.
I didn't touch anything, and the views get corrupt for no reason, at random times.
Here's what happens to view.
- This happens on every view if I export / import database
- This happens on every view if I go into MySQl and change a character manually in one cell
- Now this happens randomly, for no reasons