WordPress.org

Support

Support » WP-Advanced » Store metadata in variables or an array

Store metadata in variables or an array

Viewing 1 replies (of 1 total)
  • My solution to this problem was to fetch the array elements individually. Here’s my code:

    <?php $links = get_post_meta($post->ID, 'port_links', false); ?>
    <?php echo $links[0]; ?>
    <?php echo $links[1]; ?>

    In this case I had two meta data values with the key port_links assigned to my post. I assigned this array to the variable $links. To display the values of an array you can call them by there placement in the array using [0], [1], [2]…etc.

    Cheers.

Viewing 1 replies (of 1 total)
  • The topic ‘Store metadata in variables or an array’ is closed to new replies.