0

I am trying to switch my Wordpress site to a new theme. I could reproduce the initial issue on my live site as well but did all the following testing in my local staging environment.

Issue: As long as I stick with the current theme, the Customizer works just fine. However, as soon as I switch to another theme, the customizer stops working. It only shows a blank page in the live preview and no options in the left-side menu bar.

Here is what I have tried/found so far:

  • WordPress is on version 6.1.1
  • Issue occurs in Chrome, Brave and Firefox browsers (haven't tried any other)
  • Issue occurs on PHP 7.4, 8.0 and 8.1 alike
  • Cleared all caches
  • Deactivated all plugins
  • Resaved permalink settings
  • The issue also occurs with WordPress standard themes (I tried 2019 and 2021)
  • The WordPress Health Check Plugin did not show any issues or errors
  • Script Debug did not solve the problem
  • Replaced wp-admin and wp-includes files with files from a fresh WP install without effect
  • Theme support of current theme (Newspaper by tagdiv) has confirmed that they do not use any elements of the Customizer which could cause this problem

JavaScript console error

Uncaught SyntaxError: Unexpected token '<' ; customize.php:6017

I get the following errors in the PHP error log:

[19-Nov-2022 14:00:13 UTC] PHP Warning:  parse_url() expects parameter 1 to be string, array given in […]\wp-includes\media.php on line 5104
[19-Nov-2022 14:00:13 UTC] PHP Stack trace:
[19-Nov-2022 14:00:13 UTC] PHP   1. {main}() […]\wp-admin\customize.php:0
[19-Nov-2022 14:00:13 UTC] PHP   2. do_action() […]\wp-admin\customize.php:292
[19-Nov-2022 14:00:13 UTC] PHP   3. WP_Hook->do_action() […]\wp-includes\plugin.php:517
[19-Nov-2022 14:00:13 UTC] PHP   4. WP_Hook->apply_filters() […]\wp-includes\class-wp-hook.php:332
[19-Nov-2022 14:00:13 UTC] PHP   5. WP_Customize_Manager->customize_pane_settings() […]\wp-includes\class-wp-hook.php:308
[19-Nov-2022 14:00:13 UTC] PHP   6. WP_Customize_Cropped_Image_Control->json() […]\wp-includes\class-wp-customize-manager.php:4985
[19-Nov-2022 14:00:13 UTC] PHP   7. WP_Customize_Cropped_Image_Control->to_json() […]\wp-includes\class-wp-customize-control.php:337
[19-Nov-2022 14:00:13 UTC] PHP   8. WP_Customize_Cropped_Image_Control->to_json() […]\wp-includes\customize\class-wp-customize-cropped-image-control.php:78
[19-Nov-2022 14:00:13 UTC] PHP   9. attachment_url_to_postid() […]\wp-includes\customize\class-wp-customize-upload-control.php:59
[19-Nov-2022 14:00:13 UTC] PHP  10. parse_url() […]\wp-includes\media.php:5104
[19-Nov-2022 14:00:13 UTC] PHP Warning:  strpos() expects parameter 1 to be string, array given in […]\wp-includes\media.php on line 5111
[19-Nov-2022 14:00:13 UTC] PHP Stack trace:
[19-Nov-2022 14:00:13 UTC] PHP   1. {main}() […]\wp-admin\customize.php:0
[19-Nov-2022 14:00:13 UTC] PHP   2. do_action() […]\wp-admin\customize.php:292
[19-Nov-2022 14:00:13 UTC] PHP   3. WP_Hook->do_action() […]\wp-includes\plugin.php:517
[19-Nov-2022 14:00:13 UTC] PHP   4. WP_Hook->apply_filters() […]\wp-includes\class-wp-hook.php:332
[19-Nov-2022 14:00:13 UTC] PHP   5. WP_Customize_Manager->customize_pane_settings() […]\wp-includes\class-wp-hook.php:308
[19-Nov-2022 14:00:13 UTC] PHP   6. WP_Customize_Cropped_Image_Control->json() […]\wp-includes\class-wp-customize-manager.php:4985
[19-Nov-2022 14:00:13 UTC] PHP   7. WP_Customize_Cropped_Image_Control->to_json() […]\wp-includes\class-wp-customize-control.php:337
[19-Nov-2022 14:00:13 UTC] PHP   8. WP_Customize_Cropped_Image_Control->to_json() […]\wp-includes\customize\class-wp-customize-cropped-image-control.php:78
[19-Nov-2022 14:00:13 UTC] PHP   9. attachment_url_to_postid() […]\wp-includes\customize\class-wp-customize-upload-control.php:59
[19-Nov-2022 14:00:13 UTC] PHP  10. strpos() […]\wp-includes\media.php:5111
[19-Nov-2022 14:00:13 UTC] PHP Notice:  Function wpdb::prepare was called <strong>incorrectly</strong>. Unsupported value type (array). Please see <a href="https://wordpress.org/support/article/debugging-in-wordpress/">Debugging in WordPress</a> for more information. (This message was added in version 4.8.2.) in […]\wp-includes\functions.php on line 5835
[19-Nov-2022 14:00:13 UTC] PHP Stack trace:
[19-Nov-2022 14:00:13 UTC] PHP   1. {main}() […]\wp-admin\customize.php:0
[19-Nov-2022 14:00:13 UTC] PHP   2. do_action() […]\wp-admin\customize.php:292
[19-Nov-2022 14:00:13 UTC] PHP   3. WP_Hook->do_action() […]\wp-includes\plugin.php:517
[19-Nov-2022 14:00:13 UTC] PHP   4. WP_Hook->apply_filters() […]\wp-includes\class-wp-hook.php:332
[19-Nov-2022 14:00:13 UTC] PHP   5. WP_Customize_Manager->customize_pane_settings() […]\wp-includes\class-wp-hook.php:308
[19-Nov-2022 14:00:13 UTC] PHP   6. WP_Customize_Cropped_Image_Control->json() […]\wp-includes\class-wp-customize-manager.php:4985
[19-Nov-2022 14:00:13 UTC] PHP   7. WP_Customize_Cropped_Image_Control->to_json() […]\wp-includes\class-wp-customize-control.php:337
[19-Nov-2022 14:00:13 UTC] PHP   8. WP_Customize_Cropped_Image_Control->to_json() […]\wp-includes\customize\class-wp-customize-cropped-image-control.php:78
[19-Nov-2022 14:00:13 UTC] PHP   9. attachment_url_to_postid() […]\wp-includes\customize\class-wp-customize-upload-control.php:59
[19-Nov-2022 14:00:13 UTC] PHP  10. wpdb->prepare() […]\wp-includes\media.php:5116
[19-Nov-2022 14:00:13 UTC] PHP  11. _doing_it_wrong() […]\wp-includes\class-wpdb.php:1453
[19-Nov-2022 14:00:13 UTC] PHP  12. trigger_error() […]\wp-includes\functions.php:5835
[19-Nov-2022 14:00:13 UTC] PHP Notice:  Function wpdb::prepare was called <strong>incorrectly</strong>. The query only expected one placeholder, but an array of multiple placeholders was sent. Please see <a href="https://wordpress.org/support/article/debugging-in-wordpress/">Debugging in WordPress</a> for more information. (This message was added in version 4.9.0.) in […]\wp-includes\functions.php on line 5835
[19-Nov-2022 14:00:13 UTC] PHP Stack trace:
[19-Nov-2022 14:00:13 UTC] PHP   1. {main}() […]\wp-admin\customize.php:0
[19-Nov-2022 14:00:13 UTC] PHP   2. do_action() […]\wp-admin\customize.php:292
[19-Nov-2022 14:00:13 UTC] PHP   3. WP_Hook->do_action() […]\wp-includes\plugin.php:517
[19-Nov-2022 14:00:13 UTC] PHP   4. WP_Hook->apply_filters() […]\wp-includes\class-wp-hook.php:332
[19-Nov-2022 14:00:13 UTC] PHP   5. WP_Customize_Manager->customize_pane_settings() […]\wp-includes\class-wp-hook.php:308
[19-Nov-2022 14:00:13 UTC] PHP   6. WP_Customize_Cropped_Image_Control->json() […]\wp-includes\class-wp-customize-manager.php:4985
[19-Nov-2022 14:00:13 UTC] PHP   7. WP_Customize_Cropped_Image_Control->to_json() […]\wp-includes\class-wp-customize-control.php:337
[19-Nov-2022 14:00:13 UTC] PHP   8. WP_Customize_Cropped_Image_Control->to_json() […]\wp-includes\customize\class-wp-customize-cropped-image-control.php:78
[19-Nov-2022 14:00:13 UTC] PHP   9. attachment_url_to_postid() […]\wp-includes\customize\class-wp-customize-upload-control.php:59
[19-Nov-2022 14:00:13 UTC] PHP  10. wpdb->prepare() […]\wp-includes\media.php:5116
[19-Nov-2022 14:00:13 UTC] PHP  11. _doing_it_wrong() […]\wp-includes\class-wpdb.php:1496
[19-Nov-2022 14:00:13 UTC] PHP  12. trigger_error() […]\wp-includes\functions.php:5835

Unfortunately, I cannot make sense of it myself. Hence, any ideas on where to look further would be greatly appreciated. Thank you so much!

0

1 Answer 1

0

After a very long time trying and fiddling I finally found a solution to this issue! I tried out several Customizer Reset Plugins and came across this one. Once installed I deleted all the database theme settings it found (there was an unnamed one which I suspect was the culprit). After deleting them all and clearing my browser cache the Customizer screen was back! Can't tell how happy I am - thus I thought I'd post this here in case anyone else comes across this issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.