• Hi there,

    it seems that get_permalink() (called from within a theme) fails to grab translations of posts and pages (polylang v1.5.2)

    E.g.
    ID 10 = English post
    ID 11 = the associated Greek post

    While viewing a greek page, get_permalink(10) will return the English page’s permalink.
    Is this expected behaviour? I couldn’t find any related info, other than this thread where you suggest that this will work out of the box. But it doesn’t.

    Thanks for your time, and kudos for the great plugin!

    Anastis

    https://ww.wp.xz.cn/plugins/polylang/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Chouby

    (@chouby)

    Hi!

    What you get is what is expected as get_permalink does not translate the post id. The solution is in fact in the thread you linked to.
    get_permalink(pll_get_post(10)) will get the translated post in the correct language.

    Thank you very much for your response.
    Big fan of your plugin, by the way.

    Perhaps you’d want to document this behavior, or even better, filter these native functions, just like like you mentioned in that thread 🙂

    Since I’m a theme-builder, I’m trying to create a wrapper around a couple of translation plugins, so I’ll try to filter these functions myself anyway. Let me know if you’re open to collaboration, and if yes, I’ll try to pitch in some code.

    Regards,
    Anastis

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘get_permalink() problem’ is closed to new replies.