How to get admin page filename (2 posts)

  1. Iperdesign_IT
    Posted 3 years ago #

    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?

  2. keesiemeijer
    Posted 3 years ago #

    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.wordpress.org/Function_Reference/wp_enqueue_style

Topic Closed

This topic has been closed to new replies.

About this Topic