1

I am trying to modify the sidebar widgets under Appearance -> Widgets, but whatever I do (just change one option, or remove a widget, etc.), as soon as I press the Update button, on the bottom left it says There was an error. The response is not a valid JSON response.

Upon inspecting the Network tab of the browser DevTools, the request is showing up as v1?_local=user and the request URL is https://host/wp-json/batch/v1?_locale=user with a method of OPTIONS. This request returns a status code 200, but there is no response data - unsure if this could be the issue or not.

What I tried so far (after each point I tried editing the widgets again):

  • Updated WordPress to 5.9
  • Updated all plugins
  • Disabled all plugins
  • Switched to a different theme
  • Saved changes on the permalinks
  • Used a different .htaccess suggested by a different website
  • Checked the Site Health, it does not report any issues with the REST API

Everything else seems to work just fine, I can create/edit posts, pages, etc., but the widget editing keeps failing.

What else can I try to fix this issue?

1
  • Hi. Sorry, no answer for you, but just to let you know you're not alone!! I'm currently having this issue for the first time on a new site I'm working on. Can't find a cause. The only thing I can think of is that this site is on a Windoze server rather than the Linux I'm used to! Peter
    – Peter HvD
    Mar 2, 2022 at 11:34

2 Answers 2

1

If using IIS, check under "Handler Mappings" > "PHP_via_FastCGI" (or similar) > "Request Restrictions" > "Verbs" that "All verbs" is handled.

For me only "GET, HEAD, POST" was enabled and not OPTIONS.

1
  • Thank you, yes, I am using IIS and this fixed the problem perfectly!
    – Gyorgy
    May 17, 2023 at 12:20
0

The release of WordPress 5.8 removed the classic widgets editor in favor of the Gutenberg widget block editor to control your website widget areas.

References:

https://make.wordpress.org/core/2021/06/29/block-based-widgets-editor-in-wordpress-5-8/

https://wordpress.org/news/2021/07/tatum/

Old View of Widgets Dashboard enter image description here

New View of Widgets Dashboard enter image description here

To fix the issue add following code in the functions.php file.

File location: /var/www/html/yoursite/wp-includes/functions.php

function example_theme_support() {
    remove_theme_support( 'widgets-block-editor' );
}
add_action( 'after_setup_theme', 'example_theme_support' );

Then after reload the widgets dashboard, you will see the old dashboard view and will be able to edit the widgets.

OR

You may transform the existing widget as shown in the screenshot.

enter image description here

I hope these 2 solutions may help you.

Note: Remember to undo the changes done in the functions.php file.

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.