Support

Account

Home Forums General Issues Using group key instead of ID in acf_form()

Solved

Using group key instead of ID in acf_form()

  • Hi,
    I’ve created shortcode to display a frontend form – I was using the field group IDs but am now registering all field groups using php so there are no longer any field group IDs.

    I am now using the keys like so:

     $options = array(
                  'post_id' => 'user_'.$uid,
                  'field_groups' => array(group_6215fd137de7c,group_620e518e579cd,group_624734f02fea7,group_6225efc08388e),
                  'return' => add_query_arg( 'updated', 'true', get_permalink() )
               	);

    But this creates a php warning “Use of undefined constant group_6215fd137de7c – assumed ‘group_6215fd137de7c’ (this will throw an Error in a future version of PHP)”

    How should I use group keys in field_groups array?

  • group keys are text values, you need to put them inside ” or “”

  • Aha, thanks, apologies for the schoolboy error!

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

You must be logged in to reply to this topic.