Fix serialized data broken due to editing MySQL database in a text editor?

后端 未结 6 614
青春惊慌失措
青春惊慌失措 2020-12-30 02:25

Background: I downloaded a *.sql backup of my WordPress site\'s database, and replaced all instances of the old database table prefix with a new on

6条回答
  •  执念已碎
    2020-12-30 03:13

    I came to this same problem after trying to change the domain from localhost to the real URL. After some searching I found the answer in Wordpress documentation:

    https://codex.wordpress.org/Moving_WordPress

    I will quote what is written there:

    To avoid that serialization issue, you have three options:

    • Use the Better Search Replace or Velvet Blues Update URLs plugins if you can > access your Dashboard.
    • Use WP-CLI's search-replace if your hosting provider (or you) have installed WP-CLI.
    • Run a search and replace query manually on your database. Note: Only perform a search and replace on the wp_posts table.

    I ended up using WP-CLI which is able to replace things in the database without breaking serialization: http://wp-cli.org/commands/search-replace/

提交回复
热议问题