[wp-trac] [WordPress Trac] #45186: Admin notice jumps from above the H1 to below it when created.
WordPress Trac
noreply at wordpress.org
Thu Mar 5 08:05:10 UTC 2026
#45186: Admin notice jumps from above the H1 to below it when created.
----------------------------+---------------------------------
Reporter: dschalk | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: 7.0
Component: Administration | Version: 2.7
Severity: normal | Resolution:
Keywords: needs-patch | Focuses: ui, administration
----------------------------+---------------------------------
Comment (by codex-m):
I've checked this, and it's possible to fix it by moving all processing to
the server side. I've attached the patch to this. The best solution is to
use the new `Dom\HTMLDocument` class which is now recommended for HTML
processing. The current `WP_HTML_Tag_Processor` lacks all the methods for
this processing.
The only downside is that the new `Dom\HTMLDocument` class requires PHP
8.4 or above. I've tried the legacy PHP `DOMDocument` (supported in older
PHP versions). Still, since it uses an HTML 4 input parser, it is unstable
and unreliable with WordPress 7.0's modern look.
To test this patch, use PHP 8.4 or 8.5. All notices are moved after the
admin pages' heading tags on the server-side (via output buffering). The
visual glitch observed is no longer present (which was the main issue on
this ticket).
When the environment is using PHP 8.3 or earlier, the patch won't run and
will revert to the backward-compatible JavaScript solution, as it was
already implemented.
I've tested this patch in many scenarios, including the default core
settings pages, user edit pages, plugin settings pages, and multisite.
More testing would be appreciated if we keep this up before the WordPress
7.0 release.
In the future, when PHP 8.4 becomes the WordPress minimum version
standard, we can mark the JS code (on `common.js`) as deprecated and
finally remove it.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/45186#comment:17>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list