Create a gist now

Instantly share code, notes, and snippets.

What would you like to do? Adding Taxonomy Column Data
add_action( 'init', 'product_init' );
function product_init()
// From Part I
register_taxonomy( 'product_packages', 'products',
array( 'hierarchical' => true,
'label' => __('Product Packages'),
'query_var' => false
// Added from Part II.
// This filter sets up a call to your function which will handle adding (and removing) items
// from the columns array. This filter passes up only one argument. The array of default headers.
add_filter( 'manage_product_packages_columns', 'admin_product_packages_column_headers, 10, 1);
// This filter sets up a call to display the contents of a Product Package row column.
// The filter passes up 3 argument. We only use the second and third arguments.
add_filter( 'manage_product_packages_custom_column', 'admin_product_packages_column_row', 10, 3 );
// This function we check the column name then pull in the row data using get_metadata()
function admin_product_packages_column_row( $row_content, $column_name, $term_id )
case 'product_package_active':
$product_package_active = get_metadata('product_packages', $term_id, 'product_package_active', true);
if (!$product_package_active)
$product_package_active = "yes";
return ucfirst($product_package_active);
case 'product_package_unit_price':
return get_metadata('product_packages', $term_id, 'product_package_unit_price', true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment