• First of all congratulations on this great plugin! Love it’s lightness and great performance! I just have a litle problem:

    I use custom fields in my theme, here is the code I use to get them in and display them in the front-end:

    <?php $key="my-custom-field-key";
    $value =get_post_meta($post->ID, $key, true);
    echo $value; ?>

    This is working in my main language, but when it comes to the translated post it won’t show the custom field value. Of course I activated the custom fields sync in polylang settings.

    Any ideas?
    Thanks a lot!

    https://www.ads-software.com/plugins/polylang/

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

    (@chouby)

    Are you getting some errors? Where are you using this code? In the main loop?

    NB: synchronization is not mandatory. It’s just a help on admin side to maintain the same values between translations.

    Thread Starter morollian

    (@morollian)

    Thank you for answering so quick!

    I’m not getting any errors, and the code works in the main language. I’m using this code in the main Loop.

    What surprises me the most is that using <?php the_meta()?> instead, it echoes all the values, which means that in some way Polylang is actually synchronizing the custom fields, but when trying to get them separately using their key, it just won’t work…

    Finnally I won’t need to sych them for this project, but I keep working on it for testing purposes.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Problem getting the post meta’ is closed to new replies.