Skip to content

Instantly share code, notes, and snippets.

@jemoreto
Last active December 3, 2015 16:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jemoreto/a89d939e0656d0b99650 to your computer and use it in GitHub Desktop.
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
// 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