After changing http to https in several option_values I lost page content. So I reverted the site url back to http and tried to replace an option_value in the wp_options table with data from a recent backup using phpmyadmin. I checked the data saved correctly. However when the website is loaded the data is replaced with:
a:1:{s:12:"_multiwidget";i:1;}
The data includes serialized data. I realise that the string length values need to be correct, but the backup data was from when it was working so that should be correct. Is there other related data that needs updating like in toxonomy?
Here's the content including backslashes for sql import and split into new lines for easy reading:
a:13:{
i:1;a:0:{}
i:2;a:4:{s:5:\"title\";s:8:\"About Us\";s:4:\"text\";s:0:\"\";s:6:\"filter\";b:1;s:6:\"visual\";b:1;}
i:3;a:4:{s:5:\"title\";s:0:\"\";s:4:\"text\";
s:216:\"<a href=\"http://someurl"><img class=\"wp-image-367 alignleft\" src=\"http://someimageurl\" alt=\"\" width=\"117\" height=\"84\" /></a>\";
s:6:\"filter\";b:1;s:6:\"visual\";b:1;}
i:5;a:4:{s:5:\"title\";s:0:\"\";s:4:\"text\";s:0:\"\";s:6:\"filter\";b:1;s:6:\"visual\";b:1;}
i:6;a:4:{s:5:\"title\";s:8:\"Approach\";s:4:\"text\";s:425:\"some long text.\r\n\r\n[embed][/embed]\";s:6:\"filter\";b:1;s:6:\"visual\";b:1;}
i:7;a:4:{s:5:\"title\";s:8:\"Our Team\";s:4:\"text\";s:3016:\"<a href=\"/\"><img class=\"wp-image-4308 size-full alignleft\" src=\"http://someimageurl\" alt=\"\" width=\"270\" height=\"287\" /></a>\r\n\r\nsometext\r\n\r\n<strong>sometext</strong>\r\n\r\nsomelongtext.\";s:6:\"filter\";b:1;s:6:\"visual\";b:1;}
i:8;a:4:{s:5:\"title\";s:10:\"Contact Us\";s:4:\"text\";s:23:\"someemail\";s:6:\"filter\";b:1;s:6:\"visual\";b:1;}
i:9;a:4:{s:5:\"title\";s:0:\"\";s:4:\"text\";s:23:\"someemail\";s:6:\"filter\";b:1;s:6:\"visual\";b:1;}
s:12:\"_multiwidget\";i:1;
i:11;a:4:{s:5:\"title\";s:4:\"test\";s:4:\"text\";s:7:\"testing\";s:6:\"filter\";b:1;s:6:\"visual\";b:1;}
i:13;a:4:{s:5:\"title\";s:0:\"\";s:4:\"text\";s:53:\"\r\n\r\n \";s:6:\"filter\";b:1;s:6:\"visual\";b:1;}
i:15;a:4:{s:5:\"title\";s:0:\"\";s:4:\"text\";s:68:\"[embed];amp;t=51s[/embed]\";s:6:\"filter\";b:1;s:6:\"visual\";b:1;}
i:16;a:4:{s:5:\"title\";s:0:\"\";s:4:\"text\";s:64:\"[embed];t=51s[/embed]\";s:6:\"filter\";b:1;s:6:\"visual\";b:1;}}
I've seen these posts but still unsure: How to update widget_text in the wp_options table wp_options table value
After changing http to https in several option_values I lost page content. So I reverted the site url back to http and tried to replace an option_value in the wp_options table with data from a recent backup using phpmyadmin. I checked the data saved correctly. However when the website is loaded the data is replaced with:
a:1:{s:12:"_multiwidget";i:1;}
The data includes serialized data. I realise that the string length values need to be correct, but the backup data was from when it was working so that should be correct. Is there other related data that needs updating like in toxonomy?
Here's the content including backslashes for sql import and split into new lines for easy reading:
a:13:{
i:1;a:0:{}
i:2;a:4:{s:5:\"title\";s:8:\"About Us\";s:4:\"text\";s:0:\"\";s:6:\"filter\";b:1;s:6:\"visual\";b:1;}
i:3;a:4:{s:5:\"title\";s:0:\"\";s:4:\"text\";
s:216:\"<a href=\"http://someurl"><img class=\"wp-image-367 alignleft\" src=\"http://someimageurl\" alt=\"\" width=\"117\" height=\"84\" /></a>\";
s:6:\"filter\";b:1;s:6:\"visual\";b:1;}
i:5;a:4:{s:5:\"title\";s:0:\"\";s:4:\"text\";s:0:\"\";s:6:\"filter\";b:1;s:6:\"visual\";b:1;}
i:6;a:4:{s:5:\"title\";s:8:\"Approach\";s:4:\"text\";s:425:\"some long text.\r\n\r\n[embed]https://www.youtube/watch?v=someid[/embed]\";s:6:\"filter\";b:1;s:6:\"visual\";b:1;}
i:7;a:4:{s:5:\"title\";s:8:\"Our Team\";s:4:\"text\";s:3016:\"<a href=\"https://www.linkedin/in/someid/\"><img class=\"wp-image-4308 size-full alignleft\" src=\"http://someimageurl\" alt=\"\" width=\"270\" height=\"287\" /></a>\r\n\r\nsometext\r\n\r\n<strong>sometext</strong>\r\n\r\nsomelongtext.\";s:6:\"filter\";b:1;s:6:\"visual\";b:1;}
i:8;a:4:{s:5:\"title\";s:10:\"Contact Us\";s:4:\"text\";s:23:\"someemail\";s:6:\"filter\";b:1;s:6:\"visual\";b:1;}
i:9;a:4:{s:5:\"title\";s:0:\"\";s:4:\"text\";s:23:\"someemail\";s:6:\"filter\";b:1;s:6:\"visual\";b:1;}
s:12:\"_multiwidget\";i:1;
i:11;a:4:{s:5:\"title\";s:4:\"test\";s:4:\"text\";s:7:\"testing\";s:6:\"filter\";b:1;s:6:\"visual\";b:1;}
i:13;a:4:{s:5:\"title\";s:0:\"\";s:4:\"text\";s:53:\"https://www.youtube/watch?v=someid\r\n\r\n \";s:6:\"filter\";b:1;s:6:\"visual\";b:1;}
i:15;a:4:{s:5:\"title\";s:0:\"\";s:4:\"text\";s:68:\"[embed]https://www.youtube/watch?v=someid&t=51s[/embed]\";s:6:\"filter\";b:1;s:6:\"visual\";b:1;}
i:16;a:4:{s:5:\"title\";s:0:\"\";s:4:\"text\";s:64:\"[embed]https://www.youtube/watch?v=someid&t=51s[/embed]\";s:6:\"filter\";b:1;s:6:\"visual\";b:1;}}
I've seen these posts but still unsure: How to update widget_text in the wp_options table wp_options table value
Share Improve this question asked Jan 21, 2021 at 17:34 Nick WNick W 1231 silver badge6 bronze badges 2- 1 There are search replace tools that handle serialized PHP data, a raw SQL search replace query is almost always going to cause issues. Aside from plugins and scripts, WP CLI can do it – Tom J Nowell ♦ Commented Jan 21, 2021 at 18:05
- What I don't understand is why the backed up value is not working, unless there are related data records (I've not seen any mention of related data elsewhere). – Nick W Commented Jan 21, 2021 at 18:45
1 Answer
Reset to default 0Solved it by creating an update sql command from the backup insert sql, saving in a file using Notepad++, and imported via phpmyadmin. Maybe there had been an issue with extra newline characters or missing backslash escape characters when I tried before.