0

I would like to create a plugin that is able to inject some html on admin-pages, no matter if these are post, pages, settings or any option page for a plugin.

So I am searching for a suitable hook, so that I could run code like this (pseudo-code):

function plugin_inject_html()
{
    if( preg_match( '<regexp to parse the url>', $_SERVER['REQUEST_URI'] ) > 0 )
    {
        echo 'my html here';
    }
}
add_action( '<the hook I am searching for', 'plugin_inject_html' );

So my question is:

Which action or filter would be suitable to hook in, so that the result of the echo would arrive in the right location of the overall admin-page (inside the div.wpbody-content)?

2

If you check out the source of the /wp-admin/admin-header.php page you find the following actions:

Inside div#wpbody:

  • in_admin_header,

Inside div.wpbody-content:

  • network_admin_notices
  • user_admin_notices
  • admin_notices
  • all_admin_notices

I'm not sure what you mean by the right location, but I guess the all_admin_notices action would be the most suitable one for you?

  • thank you, that seems pretty much to be what I am looking for! Thanks!!! – philipp Oct 14 '13 at 11:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.