Support

Account

Home Forums Front-end Issues Getting Error: Use of undefined constant get_sub_field – assumed 'get_sub_field'

Solved

Getting Error: Use of undefined constant get_sub_field – assumed 'get_sub_field'

  • I’m trying to get data from a select field of a repeater and am getting the error:

    Use of undefined constant get_sub_field – assumed ‘get_sub_field’

    Since it isn’t working I’m just trying to get the value and echo it at this point. All I’m getting is a lower case ‘g’, as they are replacing the get_sub_field with the actual value for it. It is returning 6 of them, which is the number of rows, so that part is working succesfully. The problem is just returning the info from the select field.

    I’ve used a select with repeater fields numerous times and have never had this problem.

    This is basically my code.

    if( have_rows(‘Repeater Field’) ):
    while ( have_rows(‘Repeater Field’) ): the_row();
    $select = get_sub_field[‘Select Field’];
    endwhile;
    endif;

    I’m using the PRO version 5.9.3

    Please help ASAP as I’m on a time sensitive project and have been battling this for a week.

    Thank you for your consideration!

  • You can resolve this.

    I finally realized I was using brackets instead of parens.

    *face plant*

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

You must be logged in to reply to this topic.