这让我抓狂。。。我有一个管理插件页面,列出wordpress网站的页面。我试图使用get\\u pages()列出所有页面,但由于某些原因,一旦页面发布,它们就不再显示了-当我使用get\\u帖子时,它们会显示出来,但新的草稿页面不会:(
这是代码。。请帮忙
//this only displays the new draft pages - once published pages don\'t show up here
$args = array(\'post_status\' => \'draft, publish\');
$pages = get_pages($args);
foreach ( $pages as $page ) { some html code that displays the page title }
//this piece of code will return all pages onces they were published,
//even if \'unpublished\' later - but will not return new draft pages
global $post;
$args2 = array( \'numberposts\' => 50, \'post_status\' => \'publish, draft\');
$myposts = get_posts( $args2 );
foreach( $myposts as $post ) {
setup_postdata($post);
... some HTML code to display the pages
}
发生什么事了?