Show the Admin Screen ID in the Footer
Displays the current screen ID, base, post type and hook suffix in the admin footer for administrators, which is exactly what you need when targeting a screen in your own code.
Opens WPIDE on
Code
add_filter( 'update_footer', function ( $text ) {
$screen = function_exists( 'get_current_screen' ) ? get_current_screen() : null;
if ( ! $screen || ! current_user_can( 'manage_options' ) ) {
return $text;
}
return sprintf(
'<code>id: %s</code> <code>base: %s</code>%s <code>hook: %s</code> · %s',
esc_html( $screen->id ),
esc_html( $screen->base ),
$screen->post_type ? ' <code>post_type: ' . esc_html( $screen->post_type ) . '</code>' : '',
esc_html( $GLOBALS['hook_suffix'] ?? '' ),
$text
);
}, 99 );
Notes
Use the values with get_current_screen() checks or the admin_enqueue_scripts hook suffix.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.