• Matt

    (@mattk1980)


    I’ve had to write a workaround for my site because Polylang seems to be affecting the wordpress get_post_meta function.

    I was trying to get results of a post meta relationship for a specific post id.

    On a different language other than en_GB it seems to stop the function returning an array of results.

    $meta_key = "your_key";
    $meta_key = "your_post_id";
    $sql = $wpdb->prepare(
    "SELECT meta_value FROM {$wpdb->postmeta} WHERE meta_key = %s AND post_id = %s",
    $meta_key,
    $post_id
    );
    $related_ids = $wpdb->get_col($sql);

    this strangely provides a different result than using get_post_meta.
    I did not want to sync my custom fields as it creates a huge overhead.

    I don’t know if this is a bug or by design.

Viewing 1 replies (of 1 total)
  • Plugin Author Chouby

    (@chouby)

    Hello,

    I don’t know what made you believe that Polylang is the source of your issue, however it should not interfere with get_post_meta(). This is possible with get_post_metadata filter, but it’s not used in Polylang.

Viewing 1 replies (of 1 total)
  • The topic ‘get_post_meta not returning results’ is closed to new replies.