{"id":2305,"date":"2021-07-17T11:01:00","date_gmt":"2021-07-17T03:01:00","guid":{"rendered":"https:\/\/www.intelliwolf.com\/?p=2305"},"modified":"2021-07-17T11:01:02","modified_gmt":"2021-07-17T03:01:02","slug":"fix-wp-theme-customizer-not-saving","status":"publish","type":"post","link":"https:\/\/wordpress-757293-2559390.cloudwaysapps.com\/fix-wp-theme-customizer-not-saving\/","title":{"rendered":"How To Fix WordPress Theme Customizer Not Saving"},"content":{"rendered":"\n

I've been building WordPress websites since 2006 and hadn't come across this one until today.<\/p>\n\n\n\n

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.<\/p>\n\n\n\n

I tried everything from 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\n

The 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\n

I 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\n

Each 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\n

When 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\n

How to fix Theme Customizer Not Saving<\/h2>\n\n\n\n
  • Check 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\n

    This is how the wp_options<\/em> table should be structured:<\/p>\n\n\n\n

    \"screenshot<\/figure><\/div>\n\n\n\n

    My wp_options<\/em> table was missing the primary key.<\/p>\n\n\n\n

    To 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
      \"screenshot<\/figure><\/div>\n\n\n\n

      Now 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\n

      It 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":"\nHow To Fix WordPress Theme Customizer Not Saving<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.intelliwolf.com\/fix-wp-theme-customizer-not-saving\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How To Fix WordPress Theme Customizer Not Saving\" \/>\n<meta property=\"og:description\" content=\"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\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.intelliwolf.com\/fix-wp-theme-customizer-not-saving\/\" \/>\n<meta property=\"og:site_name\" content=\"Intelliwolf\" \/>\n<meta property=\"article:published_time\" content=\"2021-07-17T03:01:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-07-17T03:01:02+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/intelliwolf.com\/wp-content\/uploads\/2021\/07\/2021-07-17-fix-theme-customizer-not-saving-01-1-600x277.png\" \/>\n<meta name=\"author\" content=\"Mike Haydon\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Mike Haydon\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.intelliwolf.com\/fix-wp-theme-customizer-not-saving\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.intelliwolf.com\/fix-wp-theme-customizer-not-saving\/\"},\"author\":{\"name\":\"Mike Haydon\",\"@id\":\"https:\/\/www.intelliwolf.com\/#\/schema\/person\/7209e3ff14822e4d70d5f194a310f343\"},\"headline\":\"How To Fix WordPress Theme Customizer Not Saving\",\"datePublished\":\"2021-07-17T03:01:00+00:00\",\"dateModified\":\"2021-07-17T03:01:02+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.intelliwolf.com\/fix-wp-theme-customizer-not-saving\/\"},\"wordCount\":528,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.intelliwolf.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.intelliwolf.com\/fix-wp-theme-customizer-not-saving\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/intelliwolf.com\/wp-content\/uploads\/2021\/07\/2021-07-17-fix-theme-customizer-not-saving-01-1-600x277.png\",\"articleSection\":[\"Theme Customization\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.intelliwolf.com\/fix-wp-theme-customizer-not-saving\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.intelliwolf.com\/fix-wp-theme-customizer-not-saving\/\",\"url\":\"https:\/\/www.intelliwolf.com\/fix-wp-theme-customizer-not-saving\/\",\"name\":\"How To Fix WordPress Theme Customizer Not Saving\",\"isPartOf\":{\"@id\":\"https:\/\/www.intelliwolf.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.intelliwolf.com\/fix-wp-theme-customizer-not-saving\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.intelliwolf.com\/fix-wp-theme-customizer-not-saving\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/intelliwolf.com\/wp-content\/uploads\/2021\/07\/2021-07-17-fix-theme-customizer-not-saving-01-1-600x277.png\",\"datePublished\":\"2021-07-17T03:01:00+00:00\",\"dateModified\":\"2021-07-17T03:01:02+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.intelliwolf.com\/fix-wp-theme-customizer-not-saving\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.intelliwolf.com\/fix-wp-theme-customizer-not-saving\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.intelliwolf.com\/fix-wp-theme-customizer-not-saving\/#primaryimage\",\"url\":\"https:\/\/wordpress-757293-2559390.cloudwaysapps.com\/wp-content\/uploads\/2021\/07\/2021-07-17-fix-theme-customizer-not-saving-01-1.png\",\"contentUrl\":\"https:\/\/wordpress-757293-2559390.cloudwaysapps.com\/wp-content\/uploads\/2021\/07\/2021-07-17-fix-theme-customizer-not-saving-01-1.png\",\"width\":986,\"height\":456},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.intelliwolf.com\/fix-wp-theme-customizer-not-saving\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.intelliwolf.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Theme Customization\",\"item\":\"https:\/\/www.intelliwolf.com\/category\/theme-customization\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"How To Fix WordPress Theme Customizer Not Saving\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.intelliwolf.com\/#website\",\"url\":\"https:\/\/www.intelliwolf.com\/\",\"name\":\"Intelliwolf\",\"description\":\"WordPress, Web Design and Coding Tutorials\",\"publisher\":{\"@id\":\"https:\/\/www.intelliwolf.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.intelliwolf.com\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.intelliwolf.com\/#organization\",\"name\":\"Intelliwolf\",\"url\":\"https:\/\/www.intelliwolf.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.intelliwolf.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/wordpress-757293-2559390.cloudwaysapps.com\/wp-content\/uploads\/intelliwolf-logo-300t.png\",\"contentUrl\":\"https:\/\/wordpress-757293-2559390.cloudwaysapps.com\/wp-content\/uploads\/intelliwolf-logo-300t.png\",\"width\":300,\"height\":100,\"caption\":\"Intelliwolf\"},\"image\":{\"@id\":\"https:\/\/www.intelliwolf.com\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.intelliwolf.com\/#\/schema\/person\/7209e3ff14822e4d70d5f194a310f343\",\"name\":\"Mike Haydon\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.intelliwolf.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/d5f4754fae310a04dede91d15e57c8a0?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/d5f4754fae310a04dede91d15e57c8a0?s=96&d=mm&r=g\",\"caption\":\"Mike Haydon\"},\"sameAs\":[\"https:\/\/intelliwolf.com\/about-mike-haydon\/\"]}]}<\/script>\n","yoast_head_json":{"title":"How To Fix WordPress Theme Customizer Not Saving","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.intelliwolf.com\/fix-wp-theme-customizer-not-saving\/","og_locale":"en_US","og_type":"article","og_title":"How To Fix WordPress Theme Customizer Not Saving","og_description":"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","og_url":"https:\/\/www.intelliwolf.com\/fix-wp-theme-customizer-not-saving\/","og_site_name":"Intelliwolf","article_published_time":"2021-07-17T03:01:00+00:00","article_modified_time":"2021-07-17T03:01:02+00:00","og_image":[{"url":"https:\/\/intelliwolf.com\/wp-content\/uploads\/2021\/07\/2021-07-17-fix-theme-customizer-not-saving-01-1-600x277.png"}],"author":"Mike Haydon","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Mike Haydon","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.intelliwolf.com\/fix-wp-theme-customizer-not-saving\/#article","isPartOf":{"@id":"https:\/\/www.intelliwolf.com\/fix-wp-theme-customizer-not-saving\/"},"author":{"name":"Mike Haydon","@id":"https:\/\/www.intelliwolf.com\/#\/schema\/person\/7209e3ff14822e4d70d5f194a310f343"},"headline":"How To Fix WordPress Theme Customizer Not Saving","datePublished":"2021-07-17T03:01:00+00:00","dateModified":"2021-07-17T03:01:02+00:00","mainEntityOfPage":{"@id":"https:\/\/www.intelliwolf.com\/fix-wp-theme-customizer-not-saving\/"},"wordCount":528,"commentCount":0,"publisher":{"@id":"https:\/\/www.intelliwolf.com\/#organization"},"image":{"@id":"https:\/\/www.intelliwolf.com\/fix-wp-theme-customizer-not-saving\/#primaryimage"},"thumbnailUrl":"https:\/\/intelliwolf.com\/wp-content\/uploads\/2021\/07\/2021-07-17-fix-theme-customizer-not-saving-01-1-600x277.png","articleSection":["Theme Customization"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.intelliwolf.com\/fix-wp-theme-customizer-not-saving\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.intelliwolf.com\/fix-wp-theme-customizer-not-saving\/","url":"https:\/\/www.intelliwolf.com\/fix-wp-theme-customizer-not-saving\/","name":"How To Fix WordPress Theme Customizer Not Saving","isPartOf":{"@id":"https:\/\/www.intelliwolf.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.intelliwolf.com\/fix-wp-theme-customizer-not-saving\/#primaryimage"},"image":{"@id":"https:\/\/www.intelliwolf.com\/fix-wp-theme-customizer-not-saving\/#primaryimage"},"thumbnailUrl":"https:\/\/intelliwolf.com\/wp-content\/uploads\/2021\/07\/2021-07-17-fix-theme-customizer-not-saving-01-1-600x277.png","datePublished":"2021-07-17T03:01:00+00:00","dateModified":"2021-07-17T03:01:02+00:00","breadcrumb":{"@id":"https:\/\/www.intelliwolf.com\/fix-wp-theme-customizer-not-saving\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.intelliwolf.com\/fix-wp-theme-customizer-not-saving\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.intelliwolf.com\/fix-wp-theme-customizer-not-saving\/#primaryimage","url":"https:\/\/wordpress-757293-2559390.cloudwaysapps.com\/wp-content\/uploads\/2021\/07\/2021-07-17-fix-theme-customizer-not-saving-01-1.png","contentUrl":"https:\/\/wordpress-757293-2559390.cloudwaysapps.com\/wp-content\/uploads\/2021\/07\/2021-07-17-fix-theme-customizer-not-saving-01-1.png","width":986,"height":456},{"@type":"BreadcrumbList","@id":"https:\/\/www.intelliwolf.com\/fix-wp-theme-customizer-not-saving\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.intelliwolf.com\/"},{"@type":"ListItem","position":2,"name":"Theme Customization","item":"https:\/\/www.intelliwolf.com\/category\/theme-customization\/"},{"@type":"ListItem","position":3,"name":"How To Fix WordPress Theme Customizer Not Saving"}]},{"@type":"WebSite","@id":"https:\/\/www.intelliwolf.com\/#website","url":"https:\/\/www.intelliwolf.com\/","name":"Intelliwolf","description":"WordPress, Web Design and Coding Tutorials","publisher":{"@id":"https:\/\/www.intelliwolf.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.intelliwolf.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.intelliwolf.com\/#organization","name":"Intelliwolf","url":"https:\/\/www.intelliwolf.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.intelliwolf.com\/#\/schema\/logo\/image\/","url":"https:\/\/wordpress-757293-2559390.cloudwaysapps.com\/wp-content\/uploads\/intelliwolf-logo-300t.png","contentUrl":"https:\/\/wordpress-757293-2559390.cloudwaysapps.com\/wp-content\/uploads\/intelliwolf-logo-300t.png","width":300,"height":100,"caption":"Intelliwolf"},"image":{"@id":"https:\/\/www.intelliwolf.com\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.intelliwolf.com\/#\/schema\/person\/7209e3ff14822e4d70d5f194a310f343","name":"Mike Haydon","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.intelliwolf.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/d5f4754fae310a04dede91d15e57c8a0?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d5f4754fae310a04dede91d15e57c8a0?s=96&d=mm&r=g","caption":"Mike Haydon"},"sameAs":["https:\/\/intelliwolf.com\/about-mike-haydon\/"]}]}},"_links":{"self":[{"href":"https:\/\/wordpress-757293-2559390.cloudwaysapps.com\/wp-json\/wp\/v2\/posts\/2305"}],"collection":[{"href":"https:\/\/wordpress-757293-2559390.cloudwaysapps.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wordpress-757293-2559390.cloudwaysapps.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wordpress-757293-2559390.cloudwaysapps.com\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/wordpress-757293-2559390.cloudwaysapps.com\/wp-json\/wp\/v2\/comments?post=2305"}],"version-history":[{"count":2,"href":"https:\/\/wordpress-757293-2559390.cloudwaysapps.com\/wp-json\/wp\/v2\/posts\/2305\/revisions"}],"predecessor-version":[{"id":2311,"href":"https:\/\/wordpress-757293-2559390.cloudwaysapps.com\/wp-json\/wp\/v2\/posts\/2305\/revisions\/2311"}],"wp:attachment":[{"href":"https:\/\/wordpress-757293-2559390.cloudwaysapps.com\/wp-json\/wp\/v2\/media?parent=2305"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wordpress-757293-2559390.cloudwaysapps.com\/wp-json\/wp\/v2\/categories?post=2305"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wordpress-757293-2559390.cloudwaysapps.com\/wp-json\/wp\/v2\/tags?post=2305"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}