在这种情况下,您只需要在wp_head
行动将以下内容放置在functions.php
将解决问题:
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" />\';
}