我创建了一个插件,允许输入自定义帖子类型。在该帖子类型中,我有一个select metabox作为name。我还有一个选项页面,其中有一个文本区域框,其中有一个名称列表。我未能成功地将2个连接在一起。想法是让文本区域中的列表显示为插件中选择框的选项。对于如何实现这一目标的任何指导都将不胜感激。
Textarea的选项页中的代码
<th scope="row">Name</th>
<td><textarea id="name" name="name" rows="5" cols="36"><?php echo esc_attr( get_option(\'name\') ); ?></textarea></td>
选择框插件中的代码$options = get_option( \'name\' );
$names = explode( "", $options[\'name\'] );
?>
<select name="Name">
<?php foreach ( $names as $name ) {
printf(
\'<option value="%s">%s</option>\',
$name,
$name
);
} ?>