<?php
$args = array(
\'public\' => true,
\'_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 );
foreach ( $post_types as $post_type ) {
echo \'<p>\' . $post_type . \'</p>\';
}
?>
它将列出所有公共自定义帖子类型,您可以阅读关于get\\u post\\u类型的文档
here .