-1

There is one custom taxonomy (STORE) and i want to add this code to one taxonomy only

<link rel="alternate" hreflang="fr" href="http://www.domain.com/fr" />

What code shall i use?

0

In this case you just need a conditional tag inside of the wp_head action. Placing the following on your functions.php will solve the problem:

add_action( 'wp_head', 'q166556_taxonomy_head' );

function q166556_taxonomy_head(){
    // Conditional for Taxonomy archives and posts that have any term from the taxonomy `store`
    if ( ! has_term( '', 'store' ) && ! is_tax( 'store' ) ){
        return;
    }

    echo '<link rel="alternate" hreflang="fr" href="http://www.domain.com/fr" />';

}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.