I regain complex fields
add_action('carbon_fields_register_fields','reg_composition_fields'); function reg_composition_fields(){ Container::make( 'post_meta', 'О продукте' ) ->where( 'post_type', '=', 'goods_post_type' ) ->add_fields( array( Field::make( 'complex', 'crb_product_composition' ) ->add_fields(array( Field::make( 'text', 'crb_product_composition_el', 'Элемент состава' ) )), ))->add_fields(array( Field::make('text', 'crb_product_info_calories','Энергетическая ценность'), Field::make('text', 'crb_product_info_save','Условия хранения'), Field::make('text', 'crb_product_info_time','Срок годности'), Field::make('text', 'crb_product_info_way','Способ приготовления'), )); }
fields that are not included in the complex are displayed as they should. I derive them using the function:
carbon_get_post_meta(get_the_ID(),'crb_product_info_calories');
but when I try to output complex fields that are 'crb_product_composition', it displays an empty array. I deduce by means of the same function.
carbon_get_post_meta(get_the_ID(),'crb_product_composition','complex');
what could be the problem ? perhaps because of this line?
->where( 'post_type', '=', 'goods_post_type' )
and more. I do a debug function that displays all the fields that the record has
debug(get_post_custom(get_the_ID()));
It does this:
Array ( [_edit_last] => Array ( [0] => 1 ) [_edit_lock] => Array ( [0] => 1550759823:1 ) [_thumbnail_id] => Array ( [0] => 131 ) [_wp_old_slug] => Array ( [0] => %d1%85%d0%b8%d0%bd%d0%ba%d0%b0%d0%bb-%d1%81%d0%bb%d0%be%d0%b5%d0%bd%d1%8b%d0%b9 ) [_crb_product_composition|||0|value] => Array ( [0] => _ ) [_crb_product_composition|||1|value] => Array ( [0] => _ ) [_crb_product_composition|||2|value] => Array ( [0] => _ ) [_crb_product_composition|crb_product_composition_el|0|0|value] => Array ( [0] => Шаурма ) [_crb_product_composition|crb_product_composition_el|1|0|value] => Array ( [0] => Соль ) [_crb_product_composition|crb_product_composition_el|2|0|value] => Array ( [0] => насвай ) [_crb_product_info_calories] => Array ( [0] => куцкуц ) [_crb_product_info_save] => Array ( [0] => куцк ) [_crb_product_info_time] => Array ( [0] => цукуц ) [_crb_product_info_way] => Array ( [0] => уцкуцк ) )