我得到一个:
Fatal error: Call to undefined function is_user_logged_in() in C:\\wamp\\www\\benracicot\\wp-includes\\query.php on line 2521
如果我从WP\\u查询中删除$args,则不会出现任何错误,并且可以打印返回对象(所有空值),那么我的插件查询代码有什么错?
function getPostIDsByMonth($month){
$args = array( \'monthnum\' => 1, \'post_type\' => \'post\' );
$ids = new WP_Query($args);
return $ids;
}
$months = 1;
$bymonth = getPostIDsByMonth($months);
print_r($bymonth);
echo $bymonth->post_count;
if (! empty($bymonth)){
while($bymonth->have_posts()): $bymonth->the_post();
?><h3><a href="#"><?php the_title(); ?></a></h3><?php
the_content();
endwhile;
}