0

I created a custom control cluster for the theme customizer which includes radio input and textarea. I want to save the data as sub-array, as in array( key => array() )

The data attribute data-customize-setting-link="fieldname" is set for the radio, but clearly I can't use the same name for the textarea to add as sub array. I tried the json array method as done with name="fieldname[val]" attribute but that does not work.

Using class extension

class MyCustomControl extends WP_Customize_Control
{}

Output fields

field output image

To save bot fields I have to use different data attribute names, and the following is the saved value.

Array
(
    [custom_css_post_id] => -1
    [nav_menu_locations] => Array
        (
            [primary] => 20
        )

    [theme] => black-on-white.css
    [customcss] => body {font-family: arial;}
)

What I need

The data should be saved as the nav_menu_locations does.

array(
 [theme] => array(
  [themecss] => black-on-white.css
  [customcss] => body {}
 )
)

Update

The problem has been resolved

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.