Skip to content

Instantly share code, notes, and snippets.

@ayoubkhan558
Created January 3, 2026 18:00
Show Gist options
  • Select an option

  • Save ayoubkhan558/8844d05c942e6924dce186a7911e0d84 to your computer and use it in GitHub Desktop.

Select an option

Save ayoubkhan558/8844d05c942e6924dce186a7911e0d84 to your computer and use it in GitHub Desktop.
How to change the position of an admin notice in the WordPress admin dashboard using HTML instead of JavaScript?
I found that using `<hr class="wp-header-end">` works reliably, and the admin notice always appears directly below it.
@ayoubkhan558
Copy link
Author

I recently discovered by accident that WordPress moves all admin notices to appear after the first <h1> or <h2> tag inside a <div class="wrap">, with preference given to <h1> if it exists. This provides some control—for example, on a plugin settings page, you can place an empty <h2></h2> at the very top if you want to use <h2>Plugin Title</h2> without affecting the page’s formatting. The JavaScript responsible for this behavior can be found in /wp-admin/js/common.js.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment