Luckily, there is a simple solution, which I found on wpsnipp.com! By adding the code below to your themes functions.php file, you will have the following extra columns in WP-admin:
Here comes the code (it does not matter where in the functions file you paste it as long as it is between php open and close brackets)
<?php // Add ID's to posts and pages overviews add_filter('manage_posts_columns', 'posts_columns_id', 5); add_action('manage_posts_custom_column', 'posts_custom_id_columns', 5, 2); add_filter('manage_pages_columns', 'posts_columns_id', 5); add_action('manage_pages_custom_column', 'posts_custom_id_columns', 5, 2); function posts_columns_id($defaults){ $defaults['wps_post_id'] = __('ID'); return $defaults; } function posts_custom_id_columns($column_name, $id){ if($column_name === 'wps_post_id'){ echo $id; } } // Determine ID column width add_action('admin_head', 'custom_admin_styling'); function custom_admin_styling() { echo '<style type="text/css">'; echo 'th#wps_post_id{width:50px;}'; echo '</style>'; } // Add ID to categories overview function categoriesColumnsHeader($columns) { $columns['catID'] = __('ID'); return $columns; } add_filter( 'manage_categories_columns', 'categoriesColumnsHeader' ); function categoriesColumnsRow($argument, $columnName, $categoryID){ if($columnName == 'catID'){ return $categoryID; } } add_filter( 'manage_categories_custom_column', 'categoriesColumnsRow', 10, 3); // Show media ID in media library overview function column_id($columns) { $columns['colID'] = __('ID'); return $columns; } add_filter( 'manage_media_columns', 'column_id' ); function column_id_row($columnName, $columnID){ if($columnName == 'colID'){ echo $columnID; } } add_filter( 'manage_media_custom_column', 'column_id_row', 10, 2 ); // Show image dimensions in media library overview function wh_column( $cols ) { $cols["dimensions"] = "Dimensions (w, h)"; return $cols; } add_filter( 'manage_media_columns', 'wh_column' ); function wh_value( $column_name, $id ) { if ( $column_name == "dimensions" ): $meta = wp_get_attachment_metadata($id); if(isset($meta['width'])) echo $meta['width'].' x '.$meta['height']; endif; } add_action( 'manage_media_custom_column', 'wh_value', 11, 3 ); ?>
This post was last modified on 26/06/2018 10:28
Website en logo ontwerp voor Kookstudio Aalsmeer - voor uw kookclub, kookfeest of bedrijfsuitje in…
Website en logo ontwerp voor Kookstudio Aalsmeer - voor uw kookclub, kookfeest of bedrijfsuitje in…
Website en logo ontwerp voor Kookstudio Aalsmeer - voor uw kookclub, kookfeest of bedrijfsuitje in…
Website en logo ontwerp voor Kookstudio Aalsmeer - voor uw kookclub, kookfeest of bedrijfsuitje in…
Website en logo ontwerp voor Kookstudio Aalsmeer - voor uw kookclub, kookfeest of bedrijfsuitje in…
Building your WordPress website efficiently using the 10 tips I documented after years of experience.…
View Comments
Thanks for sharing this valuable post. I hope You Will post more knowledgeable post for us.