This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.
Alright, folks! Let’s dive into the manage_this-screen-taxonomy_custom_column action. This hook is pretty dynamic and is used to add custom content to taxonomy columns in WordPress. The dynamic part, $this->screen->taxonomy, refers to the slug of the current taxonomy.
To use manage_this-screen-taxonomy_custom_column action, you first need to register it using add_action. You can add this code to your theme’s functions.php file or better yet, create a custom WordPress Plugin. We at WePlugins always prefer creating custom plugins to ensure nothing breaks when you update your WordPress theme.
Below, we’ve laid out some live examples to help you understand how to use this hook. Happy coding!
Parameters:
- $string: (string) Custom column output. Default is empty.
- $column_name: (string) Name of the column.
- $term_id: (int) Term ID.
Live Example 1: Adding Info to New Columns
Here’s how you can add information to new columns:
// Add info to the new columns add_action( 'manage_genre_custom_column', 'weplugins_show_genre_meta_info_in_columns', 10, 3 ); function weplugins_show_genre_meta_info_in_columns( $string, $columns, $term_id ) { switch ( $columns ) { case 'characterization' : echo esc_html( get_term_meta( $term_id, 'genre-characterization', true ) ); break; } }
Live Example 2: Using the Hook
This is an example of how you can use this hook:
function weplugins_execute_on_manage_this_screen_taxonomy_custom_column_event($string, $column_name, $term_id) { // You can write code here to be executed when this action occurs in WordPress. Use the parameters received in the function arguments and implement the required additional custom functionality according to your website requirements. } // Add the action add_action( "manage_this-screen-taxonomy_custom_column", "weplugins_execute_on_manage_this_screen_taxonomy_custom_column_event", 10, 3);
Live Example 3: Removing the Hook
To remove a hook callback, use the example below:
remove_action( "manage_this-screen-taxonomy_custom_column", "weplugins_execute_on_manage_this_screen_taxonomy_custom_column_event", 10, 3 );
Please make sure to provide the same callback function name, priority, and number of arguments while removing the hook callback.
Contact Us
If you’re having any trouble using this hook, please contact our WordPress Development Team and we’d be happy to assist you.
Explore the latest in WordPress
Trying to stay on top of it all? Get the best tools, resources and inspiration sent to your inbox every Wednesday.