您可以运行一个查询来获取每个作者的帖子数量数组,然后检查该数组。这是未经测试的,因此可能需要tweeking(谷歌搜索“mysql count occurrents of value”也会产生一些结果。
$query = \'SELECT post_author, COUNT(*) as count FROM wp_posts GROUP BY post_author ORDER BY count DESC\'
$author_count = $wpdb->get_col($query);
然后,当您检查该作者的帖子数量时-
if($author_count($author_id)) > 1) : // Where $author_id is the ID of the Author being shown
// Do whatever here...
endif;
最后,如果出现错误,可能需要添加
global $wpdb;
就在
$query = ...
线