我正在构建一个选项页面,允许用户选择三篇帖子和三幅显示在网站首页上的自定义图像。我正在使用设置API创建一个自定义WP\\U查询,该查询从4个不同的CPT(“资源”、“事件”、“博客帖子”和“出版物”)中提取所有帖子,并将这些帖子的标题和ID(隐藏)填充到下拉列表中,以便用户可以相应地选择三个。
除了一个问题外,一切都很顺利:“出版物”帖子类型似乎没有显示在下拉列表中。以下是我的自定义查询设置的片段,与“admin\\u init”挂钩相关联:
add_action(\'admin_init\', \'at_register_homepage_featured_settings\');
function at_register_homepage_featured_settings() {
    /*
    * ...
    * register DB option and section which holds it
    * ... 
    */
    /* find all relevant posts to use for dropdown options */
    $args = array(
        \'post_type\' => array(\'at_publications\', \'event\', \'post\', \'at_resources\'),
        \'posts_per_page\' => -1,
        \'orderby\' => \'post_type title\',
        \'order\' => \'ASC\',
        \'post_status\' => \'publish\'
        );
    $post_query = new WP_Query( $args );
    /*
    * ...
    * populate dropdown with $post_query results above
    * ... 
    */
}
 帖子类型的名称是“at\\U publications”,正如我提到的,所有其他CPT都在下拉列表中正确显示。事实上,这段代码在我的本地安装上效果很好,但在生产站点上效果不佳。
我研究了下拉列表的最大限制是什么,大多数现代浏览器似乎支持数千个项目,所以我认为这不是问题所在(“出版物”帖子类型目前有65篇帖子)。在这里寻找任何指导或建议。提前感谢!