Created
October 19, 2018 21:12
-
-
Save georgestephanis/02b9285b8cd096435899f083abeeeed2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'admin_bar_menu', function( $wp_admin_bar ) { | |
$screen = get_current_screen(); | |
if ( is_a( $screen, 'WP_Screen' ) ) { | |
$wp_admin_bar->add_node( [ | |
'id' => 'screen_id', | |
'title' => sprintf( __( 'Screen ID: <kbd style="font-family: monospace; font-weight: 900;">%s</kbd>' ), esc_html( $screen->id ) ), | |
] ); | |
foreach ( get_object_vars( $screen ) as $key => $value ) { | |
if ( empty( $value ) || ! is_scalar( $value ) ) { | |
continue; | |
} | |
$wp_admin_bar->add_node( [ | |
'id' => 'screen_id_' . $key, | |
'parent' => 'screen_id', | |
'title' => sprintf( __( '%s: <kbd style="font-family: monospace; font-weight: 900;">%s</kbd>' ), esc_html( $key ), esc_html( $value ) ), | |
] ); | |
} | |
} | |
}, 999 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment