设置API通常需要key => value 类型我确信使用设置API保存数组数据是可能的,但它在某种程度上绕过了API的用途。
如果我对你的问题理解正确,你是想Plugin Option, 并使用该选项的值更新wp_list_table 班最直接的方法可能是将一些唯一键保存为插件选项,然后将该唯一键与用于扩展的单独数组交叉引用wp_list_table.
换句话说,构建wp_list_table 值数组,可能是这样的:
<?php
function plugin_slug_get_wp_list_table_data() {
$data = array(
\'a\' = array(
\'id\'=> \'1\',
\'name\'=> \'tom\',
\'pageurl\'=> \'someurl\',
\'notes\'=> \'someNotes\'
),
\'b\' = array(
\'id\'=> \'1\',
\'name\'=> \'tom\',
\'pageurl\'=> \'someurl\',
\'notes\'=> \'someNotes\'
),
\'c\' = array(
\'id\'=> \'1\',
\'name\'=> \'tom\',
\'pageurl\'=> \'someurl\',
\'notes\'=> \'someNotes\'
),
\'d\' = array(
\'id\'=> \'1\',
\'name\'=> \'tom\',
\'pageurl\'=> \'someurl\',
\'notes\'=> \'someNotes\'
),
);
return $data;
}
?>
然后,将插件选项另存为
\'a\',
\'b\',
\'c\', 或
\'d\'.
然后,选择:
<?php
$plugin_slug_options = get_option( \'plugin_slug_options\' );
$plugin_slug_wp_list_table_setting = $plugin_slug_options[\'wp_list_table_setting\'];
?>
然后,使用选项设置获取要更新的数据
wp_list_table:
<?php
$plugin_slug_wp_list_table_array = plugin_slug_get_wp_list_table_data();
$plugin_slug_wp_list_table_data = $plugin_slug_wp_list_table_array[$plugin_slug_wp_list_table_setting];
?>
(您实际执行
wp_list_table 更新由您决定……)