您不能通过ACF设置页执行此操作吗?您可以选择Post并将其设置为与标题相等。
Edit
更新图像以进行澄清
Edit 2
事实证明,在显示标题下拉列表时,ACF不会查询自定义类型。要包含所有帖子类型,请在/core/admin/meta\\u box\\u位置。php,更改
<div rel="post">
<?php
$choices = array();
foreach(get_posts(array(\'numberposts\'=>\'-1\')) as $v)
{
$choices[$v->ID] = $v->post_title;
}
$this->create_field(array(
\'type\' => \'select\',
\'name\' => \'location[rules][\'.$k.\'][value]\',
\'value\' => $rule[\'value\'],
\'choices\' => $choices,
));
?>
</div>
至
<div rel="post">
<?php
$choices = array();
foreach(get_posts(array(\'numberposts\'=>\'-1\', \'post_type\'=>\'any\')) as $v)
{
$choices[$v->ID] = $v->post_title;
}
$this->create_field(array(
\'type\' => \'select\',
\'name\' => \'location[rules][\'.$k.\'][value]\',
\'value\' => $rule[\'value\'],
\'choices\' => $choices,
));
?>
</div>