Skip to content

Instantly share code, notes, and snippets.

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 hoandang/515ac1ef328297230b5f to your computer and use it in GitHub Desktop.
Save hoandang/515ac1ef328297230b5f to your computer and use it in GitHub Desktop.
/* actions fired when listing/adding/editing posts or pages */
/* admin_head-(hookname) */
add_action( 'admin_head-post.php', 'admin_head_post_editing' );
add_action( 'admin_head-post-new.php', 'admin_head_post_new' );
add_action( 'admin_head-edit.php', 'admin_head_post_listing' );
function admin_head_post_editing() {
echo 'you are editing a post';
}
function admin_head_post_new() {
echo 'you are adding a post';
}
function admin_head_post_listing() {
// sample code, handy for custom post types
global $post_type;
echo 'you are listing posts, post_type: ' . $post_type ;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment