Support

Account

Home Forums General Issues How to convert field key to meta key Reply To: How to convert field key to meta key

  • The question is, why are you trying to get the value using what you posted.

    Here’s an explanation of

    
    [field_5492be0701cb6]  // field key of recipe_sections
    [1]                    // row 1
    [field_5492be5d01cb8]  // field key of section_steps
    [0]                    // row 0
    [field_5492c04b01cbb]  // field key of step_ingredients
    [0]                    // row 0
    [field_5492c13601cbf]  // field key of quantity
    

    You can convert the field key to the field name this way

    
    $field = get_field_object($field_key);
    $field_name = $field['name'];
    

    Your field has 4 levels, a repeater or flex field, two nested repeaters or flex fields and whatever quantity is. ACF creates meta keys for repeaters like this:

    
    "{$field_name}_{$row}_{$field_name}_{$row}_{$field_name}_{$row}_{$field_name}"