自定义选项|存储数组

我试图注册一个自定义选项字段来存储数组。

I register the field with register_setting('cto-addnewfield', 'list', array('type' => array())); and print the field with echo '<input type="text" name="list[]" />';. It is displayed on the page and saves the data. But it only saves as in array with key 0 and constantly overwrites it. It should every time add 1 more.

我如何做到这一点,以便它可以添加而不是覆盖自定义设置数组中的现有数据?

For example what i would like to achieve right now: Have contacts options page. Where you can write in as field value address and click add. once its added - a new field appears by same name address and has input to write inside. Then you can add another contacts field with same way - type in name phone number and it will create a new field with same name to store data. and you may create as many fields as you wish. This way wouldn't need to hardcore contacts list fields and any new field may be added easily.

评论