Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
使用此代码,我可以轻松获得帖子总数:
$post_count = count_user_posts(); echo $post_count;
但我需要总数不包括未分类的帖子。
使用以下代码并查看输出:
$args = array('posts_per_page' => -1,'category' => '-1',); $posts_array = get_posts( $args ); echo count($posts_array);
uncategorized默认情况下,类别的id为 1。
uncategorized