Last active
December 3, 2015 16:48
-
-
Save jemoreto/a89d939e0656d0b99650 to your computer and use it in GitHub Desktop.
Adds the current editing post's ID to body_class in WordPress admin
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
// Adds the current editing post's ID to body_class in WordPress admin | |
// Add this code in your theme's funtions.php | |
function post_id_to_body_admin($pid) { | |
$screen = get_current_screen(); | |
if ( 'post' == $screen->base ) { | |
global $post; | |
$pid .= ' post-id-' . $post->ID; | |
return $pid; | |
} | |
} | |
add_filter('admin_body_class', 'post_id_to_body_admin'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment