Support

Account

Home Forums Feedback Get sub field "user" value

Helping

Get sub field "user" value

  • Does somebody know how to get the “user” selected in the user repeater field

    This is wat I have (returns empty array):

                  <?php if( have_rows('schaduwraad') ): ?>
    
                    <?php while( have_rows('schaduwraad') ): the_row();
    
                      $author_id = get_the_author_meta( 'ID' );
                      $author_name = get_sub_field('reactie_author', 'user_'. $author_id ); 
                      $content = get_sub_field('reactie_content'); 
                      
                    ?>
    
              
                    <?php  echo $content; ?>
                    <?php  echo $author_name; ?>
    
                    <?php endwhile; ?>
    
                  <?php endif; ?>
  • Hi @mweterings

    Thanks for the post.

    Your code looks correct, perhaps you could try getting the user id using a different WP function such as get_current_user_id().

    This is explained in detail here: https://codex.wordpress.org/Function_Reference/get_current_user_id

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.