mirror of
https://gh.wpcy.net/https://github.com/mainwp/Code-Snippets-Functions.git
synced 2026-05-01 11:52:25 +08:00
12 lines
397 B
Text
12 lines
397 B
Text
add_filter( 'woocommerce_get_breadcrumb', 'wc_single_product_edit_cat_breadcrumbs', 9999, 2 );
|
|
|
|
function wc_single_product_edit_cat_breadcrumbs( $crumbs, $breadcrumb ) {
|
|
|
|
if ( is_product() ) {
|
|
$index = count( $crumbs ) - 2; // cat is always second last item
|
|
$value = $crumbs[$index];
|
|
$crumbs[$index][0] = 'Category: ' . $crumbs[$index][0];
|
|
}
|
|
|
|
return $crumbs;
|
|
}
|