Merge pull request #23638 from woocommerce/update/23632
woocommerce_product_post_type_link_parent_category_only filter
This commit is contained in:
commit
33ee11dd62
|
@ -216,7 +216,11 @@ function wc_product_post_type_link( $permalink, $post ) {
|
|||
$ancestors = get_ancestors( $category_object->term_id, 'product_cat' );
|
||||
foreach ( $ancestors as $ancestor ) {
|
||||
$ancestor_object = get_term( $ancestor, 'product_cat' );
|
||||
$product_cat = $ancestor_object->slug . '/' . $product_cat;
|
||||
if ( apply_filters( 'woocommerce_product_post_type_link_parent_category_only', false ) ) {
|
||||
$product_cat = $ancestor_object->slug;
|
||||
} else {
|
||||
$product_cat = $ancestor_object->slug . '/' . $product_cat;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue