Site ID Column in the Network Sites List
Adds a narrow "ID" column to Network Admin > Sites, handy when a plugin, WP-CLI command or support request asks for a blog ID.
Opens WPIDE on
Code
if ( ! is_multisite() ) {
return;
}
add_filter( 'wpmu_blogs_columns', function ( $columns ) {
return array_slice( $columns, 0, 1, true ) + array( 'wpide_site_id' => 'ID' ) + array_slice( $columns, 1, null, true );
} );
add_action( 'manage_sites_custom_column', function ( $column, $blog_id ) {
if ( 'wpide_site_id' === $column ) {
echo (int) $blog_id;
}
}, 10, 2 );
add_action( 'admin_head-sites.php', function () {
echo '<style>.column-wpide_site_id{width:4em}</style>';
} );
Notes
""
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.