Support » Plugins » Plugin hook for index-extra.php of Admin?

  • Hello everyone!

    I am trying to write my first plugin and I want the plugin to replace specific parts of code in the index-extra.php file of the wp-admin folder. I was looking around and I found a list of ‘Plugin Hooks’. However, the hook for that file doesn’t appear to be there.

    Do you guys know the hook for that file, or if there isn’t any, some tip 😀 ?

    Thanks so much,


Viewing 5 replies - 1 through 5 (of 5 total)
  • I was looking into the code of some admin files and then comparing it to the index-extra.php and it appears as a plugin hook was not specified for that file.

    Could I add this code to the index-extra to assign a plugin hook to it? :

    <?php endif;
    if ( isset($page_hook) )
    	do_action('index_extra-' . $page_hook);
    else if ( isset($plugin_page) )
    	do_action('index_extra-' . $plugin_page);

    Or it will mess everything?

    You can add do_action() hooks anywhere you want, but it kind of defeats the purpose.

    The point of hooks is to make it so you can modify what core files do without modifying core files themselves (so that upgrading is still easy).

    But if you’re going to modify core files at all, may as well just write your code directly into the file rather than adding a hook and putting your code elsewhere.

    Your call.

    Thanks for your response, adamrbrown. Yes, I found out I can write it directly, but how can I do that with a plugin? I want the plugin to replace a part of the code by a code given by the user in an options page of the plugin.

    Otherwise, I would just replace the whole thing manually 😀

    If there’s not a hook there, you probably cannot do it with a plugin (unless you create a hook first, but that brings us back to my previous comments). There are lots of hooks in the front-end WP code, but the admin code has far fewer, so it’s possible that there simply isn’t a suitable one.

    Of course, I haven’t looked myself–I’m taking your word that you checked the hooks lists (both action and filter hooks) thoroughly.

    edit: by “cannot do it with a plugin,” I mean a plugin that doesn’t also require you to modify the core files.

    Moderator Samuel Wood (Otto)

    (@otto42) Admin

    This really depends on exactly what you’re trying to do. There’s several hooks around that region, so we need to know more about what you’re trying to do so we can tell you how to do it properly.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Plugin hook for index-extra.php of Admin?’ is closed to new replies.