刚刚找到答案。。
添加posts_per_page
在参数中为-1
.
应该是这样的:
$args = array(
\'post_type\' => \'lirik_melayu\',
\'posts_per_page\'=> -1, // set the limit post to UNLIMITED (-1 is unlimited)
\'orderby\' => array(
\'ID\' => \'DESC\' ,
),
);
$query = new WP_Query( $args );
$query_contents=Array();
while ( $query->have_posts() ) {
$query->the_post();
array_push($query_contents,Array(
"id"=>get_the_ID(),
"title"=>get_the_title(),
"url"=>get_permalink(),
));
echo get_the_title()."<br />";
}