Support

Account

Home Forums Backend Issues (wp-admin) Weird meta_key's stringing field names together…

Helping

Weird meta_key's stringing field names together…

  • When my custom fields are saved to the database, their meta key seems to be strung together in one DB field. The image below consists of various ACF fields (custom_layout, custom_columns, column_1, column_2). But taking the second line for example, where does that 1 come from?

    custom_layout_custom_columns_1_column_2

    http://i.imgur.com/G4rOd5F.png

    I’m trying to nest some PHP as shown below, in order to get to the column_2, but I can’t seem to get there.

    if( have_rows('custom_layout') ):
      while ( have_rows('custom_layout') ) : the_row();
        if( have_rows('custom_columns') ):
          while ( have_rows('custom_columns') ) : the_row();
            if( have_rows('column_2') ):
              while ( have_rows('column_2') ) : the_row();
  • I can’t be sure, but, knowing something about the way ACF saves fields I would say

    you have a flexible content field named custom_layout_custom_columns
    this has a sub field named column_2

    so you should only have two while statements using those column names. If custom_columns was a sub field of custom_layout what you would see in the db would look something like

    
    custom_layout_1_custom_columns_2_column_2_custom_con....
    
    
    
    if( have_rows('custom_layout_custom_columns') ):
      while ( have_rows('custom_layout_custom_columns') ) : the_row();
            if( have_rows('column_2') ):
              while ( have_rows('column_2') ) : the_row();
    
Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Weird meta_key's stringing field names together…’ is closed to new replies.