Created
March 9, 2023 07:31
-
-
Save santanup789/32f186a6c6ded784e5da0a1c84b14105 to your computer and use it in GitHub Desktop.
Create a new column in cutom taxonomy term table and display the term 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
<?php | |
//Creating a new column in Experience term table to show term ID | |
add_filter( 'manage_edit-experience_columns', 'wpdocs_add_new_genre_columns' ); | |
add_filter( 'manage_edit-destination_columns', 'wpdocs_add_new_genre_columns' ); | |
function wpdocs_add_new_genre_columns( $columns ) { | |
$columns['catID'] = __( 'Term ID' ); | |
return $columns; | |
} | |
//Putting term ID | |
add_action( 'manage_experience_custom_column', 'wpdocs_show_genre_meta_info_in_columns', 10, 3 ); | |
add_action( 'manage_destination_custom_column', 'wpdocs_show_genre_meta_info_in_columns', 10, 3 ); | |
function wpdocs_show_genre_meta_info_in_columns( $string, $columns, $term_id ) { | |
switch ( $columns ) { | |
case 'catID' : | |
//echo esc_html( get_term_meta( $term_id, 'genre-characterization', true ) ); | |
echo $term_id; | |
break; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment