php 显示wordpress注册的自定义帖子类型列表
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php 显示wordpress注册的自定义帖子类型列表相关的知识,希望对你有一定的参考价值。
function show_registered_post_types(){
$args=array(
'public' => true,
'exclude_from_search' => false,
'_builtin' => false
);
$output = 'names'; // names or objects, note names is the default
$operator = 'and'; // 'and' or 'or'
$post_types = get_post_types($args,$output,$operator);
$posttypes_array = array();
foreach ($post_types as $post_type ) {
$posttypes_array[] = $post_type;
}
var_dump($posttypes_array);
}
add_action( 'wp_head', 'show_registered_post_types' );
以上是关于php 显示wordpress注册的自定义帖子类型列表的主要内容,如果未能解决你的问题,请参考以下文章
从 Wordpress 取消注册自定义帖子类型
php 将新的自定义帖子类型添加到Wordpress
用于显示距当前日期超过 8 个月的 WordPress 自定义帖子类型的自定义查询
PHP Wordpress自定义帖子类型注册
php 使用模板注册新的自定义帖子类型
Wordpress 在自定义帖子类型存档页面上按日期排序