Skip to content

Instantly share code, notes, and snippets.

@WebEndevSnippets
Created October 23, 2012 16:42
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 WebEndevSnippets/3939985 to your computer and use it in GitHub Desktop.
Save WebEndevSnippets/3939985 to your computer and use it in GitHub Desktop.
WordPress: Add Post ID to Admin Posts/Pages
add_filter('manage_posts_columns', 'we_posts_columns_id', 5);
add_action('manage_posts_custom_column', 'we_posts_custom_id_columns', 5, 2);
add_filter('manage_pages_columns', 'we_posts_columns_id', 5);
add_action('manage_pages_custom_column', 'we_posts_custom_id_columns', 5, 2);
/**
* Add Post ID to posts, pages admin columns
*
*/
function we_posts_columns_id($defaults){
$defaults['we_post_id'] = __('ID');
return $defaults;
}
function we_posts_custom_id_columns($column_name, $id){
if($column_name === 'we_post_id'){
echo $id;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment