How To Fix WordPress<\/a>. I was using GeneratePress, but that didn't matter, because the problem was happening in TwentyTwenty also.<\/p>\n\n\n\nThe problem kept happening, even with all the plugins deactivated and a default theme active.<\/p>\n\n\n\n
I had just moved hosting, but it was to a server I already had sites on, so I knew the server was configured correctly.<\/p>\n\n\n\n
Eventually I figured it out. When I moved hosts, for some reason the wp_options<\/em> table (and a few of the others) didn't get a primary index set.<\/p>\n\n\n\nI wish I'd taken a screenshot of the before as I can't recreate it now.<\/p>\n\n\n\n
When I turned debugging on, every time I tried to make changes I got a bunch of notices that said \"PHP Notice: Trying to get property 'post_type' of non-object<\/strong>\".<\/p>\n\n\n\nEach line referenced a different file, like \/wp-includes\/class-wp-query.php<\/em> or \/wp-includes\/post.php<\/em> with different line numbers. Going to them didn't shed much light on the root cause.<\/p>\n\n\n\nWhen I went to the wp_options<\/em> table in phpMyAdmin I got the error message: \"This table does not contain a unique column. Grid edit, checkbox, Edit, Copy and Delete features are not available<\/strong>\". This error means you don't have a unique primary key set. See below for the fix.<\/p>\n\n\n\nHow to fix Theme Customizer Not Saving<\/h2>\n\n\n\nCheck if there is a problem with the theme or the plugins,<\/li> Make sure you don't have any errors in your CSS preventing it from saving,<\/li> Check that your wp_options<\/em> table is correctly structured with a primary index.<\/li><\/ul>\n\n\n\nThis is how the wp_options<\/em> table should be structured:<\/p>\n\n\n\n <\/figure><\/div>\n\n\n\nMy wp_options<\/em> table was missing the primary key.<\/p>\n\n\n\nTo add a primary key,<\/p>\n\n\n\n
Open your database in phpMyAdmin<\/li> Go to wp_options<\/em><\/li>Go to the \"Structure\" tab<\/li> Hover over the \"More\" link on the option_id<\/em> row<\/li>Click \"Primary\"<\/li><\/ul>\n\n\n\n <\/figure><\/div>\n\n\n\nNow you should be able to save changes made in the theme customizer.<\/p>\n\n\n\n
When you click \"Primary\", you may get an error that says \"duplicate key 0 for primary<\/strong>\". That means you have two or more rows in the table that have \"0\" as their ID.<\/p>\n\n\n\nIt is because you were operating the site without a primary key set and it threw everything into an ID of 0. To fix it, either delete those rows, or if you have a copy of the table, you might want to drop the contents of that table and re-upload.<\/p>\n\n\n\n
I had that problem and ended up just dropping everything and restarting and the site is now working properly.<\/p>\n\n\n\n
I figure it's because the database ran into issues when I was importing the old table and it didn't get around to running the primary key changes on some of the tables.<\/p>\n\n\n\n
Hopefully this can save you from the hours of frustration I just went through.<\/p>\n","protected":false},"excerpt":{"rendered":"
I’ve been building WordPress websites since 2006 and hadn’t come across this one until today. I would make changes to the Advanced CSS in the Theme Customizer and it would show in the preview window. I’d hit publish and everything looked normal, but when I refreshed the page, the changes weren’t there. I tried everything<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"yoast_head":"\n
How To Fix WordPress Theme Customizer Not Saving<\/title>\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\t \n\t \n\t \n