• Resolved networkwebmasters

    (@networkwebmasters)


    If i visit url like /color/red
    WooCommerce Product Attribute Archive Meta title in tab is:- Red | Sitename

    I want this in archive meta title:- Product Color: Red | Sitename.

    How can i add this?

    Below is the code only work with single attribute term, but this code also add attribute label in product category archive meta title which is i don’t want, i want show attribute label in meta title on all attribute term link archive pages.

    I know it work using seo plugin, but i want to achieve this using code.

    function wc_custom_archive_title( $title ) {
    if ( is_product_taxonomy() && isset( $title[‘title’] ) ) {
    $taxonomy = ‘pa_color’;
    $label_name = get_taxonomy($taxonomy)->labels->singular_name;
    if ($label_name) {
    $label_name = ($label_name.’: ‘);
    }
    $term = get_queried_object();
    $termid = $term->term_id;
    $page_title = apply_filters( ‘woocommerce_page_title’, $term->name );
    $title[‘title’] = “$label_name”.”$page_title”;
    }
    return $title;
    }
    add_filter( ‘document_title_parts’, ‘wc_custom_archive_title’ );

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘How To Add Woocommerce Attribute Label In Archive Meta Title?’ is closed to new replies.