On my WooCommerce web shop, I would like to remove Archive of :
from main title on product category archives pages.
I have tried to use this code based on this answer, But it doesn’t work:
function changing_category_archive_page_title( $page_title ) {
if(is_product_category()) {
$title_arr = explode(' :', $page_title);
$new_title = $title_arr[2];
if(!empty($new_title)) echo $new_title;
else echo $page_title;
}
}
add_filter( 'woocommerce_page_title', 'changing_category_archive_page_title', 10, 1 );
How can I do to remove Archive of :
from title?
Thanks.