ID Column on Category and Tag Screens
Adds a sortable ID column to categories, tags and every other taxonomy screen, handy for shortcodes and filters that need term IDs.
Opens WPIDE on
Code
add_action( 'admin_init', function () {
foreach ( get_taxonomies( array( 'show_ui' => true ) ) as $taxonomy ) {
add_filter( "manage_edit-{$taxonomy}_columns", function ( $columns ) {
$columns['wpide_term_id'] = 'ID';
return $columns;
} );
add_filter( "manage_{$taxonomy}_custom_column", function ( $content, $column, $term_id ) {
return 'wpide_term_id' === $column ? (string) (int) $term_id : $content;
}, 10, 3 );
add_filter( "manage_edit-{$taxonomy}_sortable_columns", function ( $columns ) {
$columns['wpide_term_id'] = 'term_id';
return $columns;
} );
}
} );
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.