Support

Account

Home Forums Bug Reports Relationship Notice

Helping

Relationship Notice

  • I think the documentation needs to be updated for how to query the relationship field https://www.advancedcustomfields.com/resources/relationship/.

    I’m on WordPress v4.8 and ACF v5.5.14.

    If I run

    <?php 
    $posts = get_field('relationship_field_name');
    if( $posts ): ?>

    and there are no posts then WordPress shows Notice: Uninitialized string offset: 0 in /Applications/MAMP/htdocs/nyss/wp-includes/class-wp-query.php on line 3162.

    I fixed this by calling get_field directly in the if statement.

    <?php 
    if( get_field('course_faculty') ):
    $posts = get_field('course_faculty');
    ?>
  • Thanks Celso!

    That solved for me too

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

The topic ‘Relationship Notice’ is closed to new replies.