How to get data from an array using get_user_meta()

I have created a custom user profile field

<?php $basics = get_the_author_meta( 'fbasics', $user->ID ); ?>
    <ul>
        <li><input value="lesson1" name="fbasics[]" <?php if (is_array($basics)) { if (in_array("lesson1", $basics)) { ?>checked="checked"<?php } }?> type="checkbox" /> <?php _e('Lesson 1', 'gprofile'); ?></li>
        <li><input value="lesson2" name="fbasics[]" <?php if (is_array($basics)) { if (in_array("lesson2", $basics)) { ?>checked="checked"<?php } }?> type="checkbox" /> <?php _e('Lesson 2', 'gprofile'); ?></li>
    </ul>

I now need to use the data on the front end of wordpress to display information. I think I need to use the get_user_meta() function but I do not understand how to use is to get the value of an array.

Read More

How to get data from an array using get_user_meta()?

Related posts

Leave a Reply

1 comment

  1. $basics = get_user_meta($user->id,'fbasics',true);
    

    if it also not works then change true to false so you’ll get full user meta and var_dump($basics) to check if ‘fbasics’ really exists or not