[Resolved] Hreflang tags created with Elements not appearing

Home Forums Support [Resolved] Hreflang tags created with Elements not appearing

Home Forums Support Hreflang tags created with Elements not appearing

Viewing 15 posts - 1 through 15 (of 16 total)
  • Author
  • #1474377


    I’ve recently implemented hreflang tags across a pair of sites (added to private info), both using GP premium.

    I’ve used Elements – wp-head, to add them and it has worked on all pages and posts with the exception of:


    The pages on which they appear properly and those on which they don’t are the same on the two sites.

    Could you have a look for me? I’ll also include login details.



    Solved it!

    Those two pages are my home page and my blog page. It turns out in Elements’ Display Rules there are specific locations for ‘Front Page’ and ‘Blog’. I’d been using ‘Page’ for all, and then selecting the relevant page from the dropdown.

    All working fine now.




    Customer Support

    Hi there,

    glad you found the answer 🙂


    Hi David, (am trying to contact the original question setter)

    I am looking to do the same thing (adding Hreflang tags) to my own website. I wondered if you could explain how you did it?
    Did you need to create a new element for each page/post?

    I am doing it within one domain not two sites but think otherwise it is the same.

    I hope to hear from you.

    Customer Support

    Hi there,

    no need for multiple Elements.
    For each Element you can set any number of Display Rules. Or use a single display rule that covers your needs.

    For example the Entire Site display location will cover the entire site. This would be Global scope.
    Or a wide scope Display Rule could be Posts > All Posts

    You can match Locations with Exclusions. For example: Location: Entire Site and Exclude: Page > A specific page.


    Hi David,
    Thank you for your reply. I was expecting from the other David that first posted but Im sure you can still help, thank you.

    I am looking to use Hreflang tag which is for telling Google about alternative pages in different languages. I therefore have to reference specific pages (the alternative languages) within the element.

    I think I therefore need a new element for each page that is then located in the ‘head’ of each language version of that page, which I can do using the drop down options.
    I have done this and it seems to work.
    My question is:
    If I have lots of elements, (if I translate 100+ pages this would require 100+ Hook Element) will it slow down the whole website or just the slow the pages where the Element is applied?
    Do you know of a better method?

    Customer Support

    Which translation plugin are you using ?


    I’m not.
    I am just doing it using the hook element to avoid another plugin.
    Maybe not saving anything?


    Customer Support

    Hmmm…. it would be good if there was a way of identifying the language such as Taxonomy term. Are the foreign language posts in a separate category or ? If so then you can use the Post Category or Post Tags display rule.

    If there is no specific category/tag term – then you can register a custom taxonomy for your display rules – see this topic:



    I hope this is relevant to the thread: I am attempting to add <html lang=”da”> to improve hyphenation / line-breaking on a Danish language site I am working on.

    I created a hook like so:
    Elements > create new hook > <html lang=”da”>
    Settings: Hook > wp_head
    Display rules: Location > Entire Site

    Is this the proper way to get a tag to display inside the HTML tag?

    Thanks in advance.

    Customer Support

    Hi Leo,

    Good to hear. I am seeing it also in the source code of my page, so the hook is working.

    But: very first line of code in the page source is

    <html lang="en-US">

    Is there a function in GeneratePress to change this to, for example, Danish?


    The answer to my own question:
    Wordpress dashboard > Settings > General > Site Language


    And if you don’t want the WP Dashboard language to change along with the site language, you can set a custom language for each user under the user preferences in WP Dashboard.

Viewing 15 posts - 1 through 15 (of 16 total)
  • You must be logged in to reply to this topic.