• I have to add a stylesheet inside the admin page “Plugins” (plugins.php) . Is there a way to know the admin page filename to do this?

Viewing 1 replies (of 1 total)
  • Moderator keesiemeijer

    (@keesiemeijer)

    use the “admin_print_scripts-plugins.php” hook:

    function add_scripts_to_plugins_page($hook) {
       // register and enque plugins.php stylesheets here
    }
    add_action( 'admin_print_scripts-plugins.php', 'add_scripts_to_plugins_page' );

    or use get_current_screen() to get the current admin page:

    add_action('admin_enqueue_scripts', 'add_admin_stylesheets');
    function add_admin_stylesheets() {
     global $my_admin_page;
     $screen = get_current_screen();
     if($screen->id == 'plugins') {
       // register and enqueue stylesheets here
     }
    }

    and register and enqueue your stylesheets: https://codex.www.ads-software.com/Function_Reference/wp_enqueue_style

Viewing 1 replies (of 1 total)
  • The topic ‘How to get admin page filename’ is closed to new replies.