Last active
August 29, 2015 14:14
-
-
Save danielpataki/9f3055de29f8359856f4 to your computer and use it in GitHub Desktop.
Revealing Post Ids
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
$custom_post_types = get_post_types( | |
array( | |
'public' => true, | |
'_builtin' => false | |
), | |
'names' | |
); | |
foreach ( $custom_post_types as $post_type ) { | |
add_action( 'manage_edit-'. $post_type . '_columns', 'revealid_add_id_column' ); | |
add_filter( 'manage_'. $post_type . '_custom_column', 'revealid_id_column_content' ); | |
} |
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
$taxonomies = get_taxonomies(); | |
foreach ( $taxonomies as $taxonomy ) { | |
add_action( 'manage_edit-' . $taxonomy . '_columns', 'revealid_add_id_column' ); | |
add_filter( 'manage_' . $taxonomy . '_custom_column', 'revealid_id_column_content' ); | |
} |
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
function revealid_add_id_column( $columns ) { | |
$checkbox = array_slice( $columns , 0, 1 ); | |
$columns = array_slice( $columns , 1 ); | |
$id['revealid_id'] = 'ID'; | |
$columns = array_merge( $checkbox, $id, $columns ); | |
return $columns; | |
} |
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', 'revealid_add_id_column' ); | |
add_action( 'manage_posts_custom_column', 'revealid_id_column_content' ); | |
add_filter( 'manage_pages_columns', 'revealid_add_id_column' ); | |
add_action( 'manage_pages_custom_column', 'revealid_id_column_content' ); | |
add_filter( 'manage_media_columns', 'revealid_add_id_column' ); | |
add_action( 'manage_media_custom_column', 'revealid_id_column_content' ); | |
add_filter( 'manage_project_columns', 'revealid_add_id_column' ); | |
add_action( 'manage_project_custom_column', 'revealid_id_column_content' ); |
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', 'revealid_add_id_column' ); | |
add_action( 'manage_posts_custom_column', 'revealid_id_column_content' ); | |
function revealid_add_id_column( $columns ) { | |
$columns['revealid_id'] = 'ID'; | |
return $columns; | |
} | |
function revealid_id_column_content( $column, $id ) { | |
if( 'revealid_id' == $column ) { | |
echo $id; | |
} | |
} |
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_action( 'manage_users_columns', 'revealid_add_id_column' ); | |
add_filter( 'manage_users_custom_column', 'revealid_id_column_content' ); | |
add_action( 'manage_edit-comments_columns', 'revealid_add_id_column' ); | |
add_action( 'manage_comments_custom_column', 'revealid_id_column_content' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment