您需要进行自定义查询以显示这些挂起的帖子。下面是一个使用get_posts()
:
$args = array(
\'post_type\' => \'post_type_name\',
\'post_status\' => \'pending\',
// -1 shows all
\'posts_per_page\' => -1,
);
$pending_posts = get_posts( $args );
foreach( $pending_posts as $pending_post ) {
// post object properties
$id = $pending_post->ID;
$title = $pending_post->post_title;
$content = $pending_post->post_content;
// output
echo $id;
echo $title;
echo $content;
}
如果需要筛选现有查询而不是创建新查询(例如,在存档页上),则应使用
pre_get_posts()
.