在ACF

时间:2018-10-28 03:41:56

标签: wordpress advanced-custom-fields

因此,我在WordPress的编辑页面中创建了一个字段组,其中包含标签,其中包含 repeater字段。所有控件功能都可以正常工作,但是当我尝试添加数据并保存更改时,它没有保存。

不确定我错过了什么。这是我填充的字段的代码

 acf_add_local_field( array (
                    'key'               => 'field_tab_size_'.$ctr,
                    'label'             => $cterm->name,
                    'name'              => 'store_sizes_',
                    'type'              => 'tab',
                    'parent'            => 'field_5bd2b8b70a9e0',
                    'instructions'      => '',
                    'required'          => 0,
                    'conditional_logic' => 0,
                    'wrapper'           => array (
                        'width'             => '',
                        'class'             => '',
                        'id'                => '',
                    ),
                    'collapsed'         => '',
                    'min'               => '',
                    'max'               => '',
                ));
                 /** 
                 * Initial Repeater Field
                 *
                 */
                acf_add_local_field( array (
                    'key'               => '_field_product_sizes_prices'.$ctr,
                    'label'             => 'Product Sizes and Prices',
                    'name'              => 'product_sizes_',
                    'type'              => 'repeater',
                    'parent'            => 'field_5bd2b8b70a9e0',
                    'instructions'      => '',
                    'required'          => 0,
                    'conditional_logic' => 0,
                    'wrapper'           => array (
                        'width'             => '',
                        'class'             => '',
                        'id'                => '',
                    ),
                    'collapsed'         => '',
                    'min'               => '',
                    'max'               => '',
                    'layout'            => 'table',
                    'button_label'      => 'Add Row'
                ));

                /** 
                 * Add Product Total
                 *
                 */
                acf_add_local_field( array (
                    'key'            => 'field_total_products_',
                    'label'          => 'Total Products',
                    'name'           => '_total_products_',
                    'parent'         => '_field_product_sizes_prices'.$ctr, // key of parent repeater
                    'type'           => 'text',
                    'instructions'   => '',
                ));

                /**
                  * Add Total Prices
                  * */

                acf_add_local_field( array (
                    'key'            => 'field_total_prices_',
                    'label'          => 'Total Prices',
                    'name'           => '_total_prices_',
                    'parent'         => '_field_product_sizes_prices'.$ctr,
                    'type'           => 'text',
                ));

            }

0 个答案:

没有答案