Support » Fixing WordPress » Get two post meta keys and values print array

Viewing 2 replies - 1 through 2 (of 2 total)
  • For meta keys that only have one entry per key

    $meta_keys = array('custom1', 'custom2');
    foreach ($meta_keys as $key) {
            $key_value = get_post_meta($post->ID, $key, true);
            if (!empty($key_value)) echo 'Key: '.$key.' Value: '.$key_value;
    }

    The question is, do you you have more then one value and multiple keys of the same name?

    Excellent thank you

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Get two post meta keys and values print array’ is closed to new replies.