Last active
August 29, 2015 14:02
-
-
Save jeremyjaymes/3e418a883c94360d21ec to your computer and use it in GitHub Desktop.
Custom "Tax ID" Column for WordPress Admin Columns
This file contains hidden or 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
//* Show the taxonomy ID | |
add_filter( "manage_edit-my_tax_columns", 'my_add_col' ); | |
add_filter( "manage_edit-my_tax_sortable_columns", 'my_add_col' ); | |
add_filter( "manage_my_tax_custom_column", 'my_tax_id', 10, 3 ); | |
function my_add_col( $new_columns ) { | |
$new_columns = array( | |
'cb' => '<input type="checkbox" />', | |
'name' => __('Name'), | |
'slug' => __('Slug'), | |
'posts' => __('Posts'), | |
'tax_id' => 'ID' | |
); | |
return $new_columns; | |
} | |
function my_tax_id( $value, $name, $id ) { | |
return 'tax_id' === $name ? $id : $value; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment