How to change the title page for an admin page in a plugin?

You don’t need to hook anywhere in particular, just output your title at the beginning of your settings page callback and WP should position the admin notice appropriately after your title (written some logic in js/jquery) Has gone).

For example I have lines like this at the beginning of various plugin settings pages.

<div class="wrap">      
    <h1><?php _e( 'My Plugin Name', 'my_text_domain' ); ?></h1>
    <?php settings_errors(); ?>

Some have additional or other markup, but admins notice, whether they are “Settings Saved” or error notices are always presented after the title. you can move <?php settings_errors(); ?> Part of my example before the title and WP will move the notice when it is presented.

I can’t remember off the top of my head where this is done in Core JS, but I’ll have a dig and edit that info into this answer.

Leave a Comment