Remove “Archives” from HTML Title

To remove the “Archives” text added by WooCommerce on product category pages to the <title> tag in the <head> of the <html> we’ve created this simple filter …


add_filter('pre_get_document_title', 'custom_pre_get_document_title', 16);

function custom_pre_get_document_title($title) {

    if (is_tax('product_cat')) {

        $title = str_replace(' Archives - ', ' - ', $title);

    }

    return $title;

}

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *