How can I add my custom meta tag?
-
Hello, I have 4 versions of my store for a few regions and I have a need to add hreflang. But I don’t understand how can I edit head of the site. Can you help me or give some advice?
Hello,
We recommend finding a plugin as the default Woocommerce does not provide the options.
If you want to add code to the Header, you would better use this plugin https://wordpress.org/plugins/insert-headers-and-footers/
Best Regards
Thank you for your advice! It’s a perfect solution for static code, but I need to get my current URL. Like: <link rel=”alternate” hreflang=”en-ca” href=”<– Current URL here –>” />
Maybe you can give an advice for this situation? Thank you very much!
Hello,
You need to add the code to the functions.php of the child theme
function woodmart_add_link_to_head(){
global $wp;
?>
<link rel="alternate" hreflang="en-ca" href="<?php echo home_url( $wp->request ); ?>" />
<?php
}
add_action( 'wp_head', 'woodmart_add_link_to_head');
Best Regards