WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Get two post meta keys and values print array

[Resolved] Get two post meta keys and values print array

Viewing 2 replies - 1 through 2 (of 2 total)
  • Frumph
    Participant

    @frumph

    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?

    Pete
    Participant

    @angio

    Excellent thank you

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