Created
October 23, 2012 16:42
-
-
Save WebEndevSnippets/3939985 to your computer and use it in GitHub Desktop.
WordPress: Add Post ID to Admin Posts/Pages
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
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