Home Forums Bug Reports Relationship Notice


Relationship Notice

  • I think the documentation needs to be updated for how to query the relationship field

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

    If I run

    $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.

    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.