Finding the screen id of a page generated with add_menu_page

The function add_menu_page return the hook suffix that inform you about the current page.

A simple example to get the hook suffix.

public function add_menu_page() {
    $page_hook_suffix = add_menu_page(
        esc_html__( 'Admin Page', 'translation-slug' ),
        esc_html__( 'Admin Page', 'translation-slug' ),
        'read',
        'My Name',
        array( $this, 'get_styles' )
    );
    add_action( 'admin_print_scripts-' . $page_hook_suffix, array( $this, 'enqueue_assets' ) );
}

The example above add the scripts only on the custom admin page, because the hook admin_print_scripts-* is fired only on the hook suffix from the return value of add_menu_page.

WP_Screen

Also, you can use the function get_current_screen to identify the page and use the value after identification.

Helpers

There are also helper plugins to find this value, if is not dynamically, like Query Monitor and Debug Objects.

Screenshot

Query Monitor Current Screen

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)