• Hello,
    In our wp multisite, we have multiple sites with an hreflang language id of “en-us” or “en-gb”.

    e.g.
    Site ID….HrefLang
    1 …….. en-us
    2 …….. en-us
    3 …….. en-gb
    4 …….. en-gb

    Within the hreflang add_links class, when the function get_language_id( $blog_id ) runs the array_flip( $this->language_blogs->to_array() ) it removes 2 values and i am left with:
    en-us => 2
    en-gb => 4

    This same thing happens in the Hreflang wp_head(). Can you fix this?
    btw, Love the plugin!

    • This topic was modified 6 years, 7 months ago by John Parker.
Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author edward_plainview

    (@edward_plainview)

    That bug can be fixed, but are several blogs allowed to have the same language IDs to start off with?

    Thread Starter John Parker

    (@jpwebcast)

    Yes, each site is a particular brand.
    e.g.
    Toys UK
    Toys US
    Toys Japan
    Toys Spain
    Protein US
    Protein UK
    Protein Japan
    Protein Spain
    etc…

    So ideally we are currently only broadcasting within brands, like: Toys UK => Toys US, Toys Japan, and Toys Spain. And not Toys UK => Protein US.
    Hopefully that makes sense.

    • This reply was modified 6 years, 7 months ago by John Parker.
    Plugin Author edward_plainview

    (@edward_plainview)

    Oh, I see. Then the problem is not really the non-unique languages, but rather that all of the languages from all of the brands are being mixed together. My reasoning is that Protein Japan should not be offering the hreflang of Toys Span, for example.

    Perhaps hooking into the broadcast_hreflang_add_links action, in order to selectively add and remove links, would be a better idea?

    Thread Starter John Parker

    (@jpwebcast)

    I’m not sure. I am thinking it would be better to keep all blog href languages in the $action->language_blogs array. Seems like if we used the broadcast_hreflang_add_links action, we will need to separately keep track of the sites that have the same hreflang language.

    Plugin Author edward_plainview

    (@edward_plainview)

    You’ll have to keep track manually, yes.

    Is it correct that Protein US suggests Toys Japan as its JA hreflang?

    Thread Starter John Parker

    (@jpwebcast)

    It isn’t viable to manually track as we have over 100 brands and multiple languages per brand.

    Toys Japan would have an hreflang of “ja”
    Protein US would have hreflang of “en-us”

    If we broadcast a post from Toys Japan to Protein US, that would work. But where we get an error is if I want to broadcast from Toys US to Protein US…because the $action->language_blogs only has a “en-us” value for Protein US after the array_flip().

    Plugin Author edward_plainview

    (@edward_plainview)

    I’ve modified the add-on to allow for duplicate language references.

    Could you e-mail me so I can send you the updated add-on?

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Hreflang language IDs being removed on array_flip’ is closed to new replies.