Can’t save code (html, script, php) in widgets, it used to work
-
Hello!
I’m in the process of testing the migration of my hosting from php 7.4 to 8.1, as 7.4 isn’t maintained anymore, however I stumbled upon an issue I can’t quite figure out. May I humbly ask for help or tips, please? Thanks so much!
The context:
I observed it on a clone (files + database, just editing the settings path to its test subdirectory) of an active 6.1 wordpress blog fully working in a php 7.4 environment…
BUT I also observed it on a brand new wordpress, installed on an empty directory with a freshly downloaded wordpress zip archive, using a brand new freshly created database. Only 1 plugin was added, Classic Widgets (to avoid the subjectively cumbersome block editing from the widgets management.)
Environment: Debian Buster, webmin+virtualmin, the panel allows to fine-tune, directory per directory, which php execution mode is to be used, with a “default for everyone, save [chosen folders: php version x.y]” principle. The php versions used to test are 8.1.13 and (the default) 7.4.33.
Final bit of context: I use the oh-so-precious Classic Widgets plugin, to avoid block editing thrown into the widgets menu (https://www.ads-software.com/plugins/classic-widgets/).
The bug:
Saving the text contents of widgets only works when this is basic html content. (Think p, center.)
Anything more complex, a script, a form, or php, it won’t be saved. I click the “Save” button, a spinning wheel icon starts rotating left of the Save button… and nothing more happens. if I come back five actual minutes later to check, the button is still spinning, if I refresh the page, the change hasn’t been saved.
A screenshot: https://imgur.com/a/cS8hCzQ
An example of the code that won’t be saved into a widget area, this is, plainly, a search form, no more, no less:
<div class="search_main"> <form method="get" class="searchform" action="/" autocomplete="off"> <input type="text" class="field s" name="s" value="Search..." onfocus="if (this.value == 'Search...') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Search...';}" autocomplete="off"> <button type="submit" class="fa fa-search submit" name="submit" value="Search"></button> </form> <div class="fix"></div> </div>
I do possess a plugin for enhanced widgets, that allow php code to run, but I can assure you, if I deactivate this plugin and run the test again, the problem hasn’t gone. (The problem is also present on a fresh wordpress with default plugins and settings, save for the addition of Classic Widgets.)
I tried without the “Classic widgets” feature that I use to disable block editing in wordpress widgets, went to create a “Code” widget, pasted inside the code I quoted above, and it gave “There was an error. The response is not a valid JSON response.”. No idea if that’s the same issue or not, though.
I checked the website’s apache error log, without a risk of false positives as it was a test ground: nothing is recorded, at all, when I click the “Save” button and nothing happens.
… And at this point, I’m at my wit’s end.
Please, would anyone know what may be causing it, or how I may further debug it to find what may be causing it?
All help and suggestions will be more than welcome, thank you!
- The topic ‘Can’t save code (html, script, php) in widgets, it used to work’ is closed to new replies.