woocommerce_admin_product_term_list
Filters the term list rendered in the products list table taxonomy column.
Usage
add_filter( 'woocommerce_admin_product_term_list', 'wp_kama_woocommerce_admin_product_term_list_filter', 10, 5 );
/**
* Function for `woocommerce_admin_product_term_list` filter-hook.
*
* @param string $term_list Comma separated list of escaped term links.
* @param string $taxonomy Taxonomy the terms belong to.
* @param int $product_id ID of the product the terms are rendered for.
* @param string[] $termlist Individual escaped term links.
* @param WP_Term[]|WP_Error $terms Term objects assigned to the product, or the WP_Error returned
* by get_the_terms().
*
* @return string
*/
function wp_kama_woocommerce_admin_product_term_list_filter( $term_list, $taxonomy, $product_id, $termlist, $terms ){
// filter...
return $term_list;
}
- $term_list(string)
- Comma separated list of escaped term links.
- $taxonomy(string)
- Taxonomy the terms belong to.
- $product_id(int)
- ID of the product the terms are rendered for.
- $termlist(string[])
- Individual escaped term links.
- $terms(WP_Term[]|WP_Error)
- Term objects assigned to the product, or the WP_Error returned by get_the_terms().
Changelog
| Since 3.3.0 | Introduced. |
Where the hook is called
woocommerce_admin_product_term_list
woocommerce_admin_product_term_list
woocommerce/includes/admin/list-tables/class-wc-admin-list-table-products.php 370
echo apply_filters( 'woocommerce_admin_product_term_list', implode( ', ', $termlist ), 'product_cat', $this->object->get_id(), $termlist, $terms ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Term names and links are escaped above; the filter returns extension-controlled markup by design.
woocommerce/includes/admin/list-tables/class-wc-admin-list-table-products.php 398
echo apply_filters( 'woocommerce_admin_product_term_list', implode( ', ', $termlist ), 'product_tag', $this->object->get_id(), $termlist, $terms ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Term names and links are escaped above; the filter returns extension-controlled markup by design.