*
* These functions must be used within the WordPress Loop.
*
- * @link http://codex.wordpress.org/Author_Templates
+ * @link https://codex.wordpress.org/Author_Templates
*
* @package WordPress
* @subpackage Template
*
* @since 0.71
* @see get_the_author()
- * @link http://codex.wordpress.org/Template_Tags/the_author
+ * @link https://codex.wordpress.org/Template_Tags/the_author
*
* @param string $deprecated Deprecated.
* @param string $deprecated_echo Deprecated. Use get_the_author(). Echo the string or return it.
/**
* Retrieve the requested data of the author of the current post.
- * @link http://codex.wordpress.org/Template_Tags/the_author_meta
+ * @link https://codex.wordpress.org/Template_Tags/the_author_meta
* @since 2.8.0
* @param string $field selects the field of the users record.
* @param int $user_id Optional. User ID.
/**
* Retrieve the requested data of the author of the current post.
- * @link http://codex.wordpress.org/Template_Tags/the_author_meta
+ * @link https://codex.wordpress.org/Template_Tags/the_author_meta
* @since 2.8.0
* @param string $field selects the field of the users record.
* @param int $user_id Optional. User ID.
* If the author has a home page set, echo an HTML link, otherwise just echo the
* author's name.
*
- * @link http://codex.wordpress.org/Template_Tags/the_author_link
+ * @link https://codex.wordpress.org/Template_Tags/the_author_link
*
* @since 2.1.0
*/
if ( ! $post ) {
return 0;
}
- return count_user_posts( $post->post_author );
+ return count_user_posts( $post->post_author, $post->post_type );
}
/**
* Display the number of posts by the author of the current post.
*
- * @link http://codex.wordpress.org/Template_Tags/the_author_posts
+ * @link https://codex.wordpress.org/Template_Tags/the_author_posts
* @since 0.71
*/
function the_author_posts() {
* reason for this, is that another function is used to help in printing the
* link to the author's posts.
*
- * @link http://codex.wordpress.org/Template_Tags/the_author_posts_link
+ * @link https://codex.wordpress.org/Template_Tags/the_author_posts_link
* @since 1.2.0
* @param string $deprecated Deprecated.
*/
/**
* List all the authors of the blog, with several options available.
*
- * @link http://codex.wordpress.org/Template_Tags/wp_list_authors
+ * @link https://codex.wordpress.org/Template_Tags/wp_list_authors
*
* @since 1.2.0
*
$authors = get_users( $query_args );
$author_count = array();
- foreach ( (array) $wpdb->get_results( "SELECT DISTINCT post_author, COUNT(ID) AS count FROM $wpdb->posts WHERE post_type = 'post' AND " . get_private_posts_cap_sql( 'post' ) . " GROUP BY post_author" ) as $row ) {
+ foreach ( (array) $wpdb->get_results( "SELECT DISTINCT post_author, COUNT(ID) AS count FROM $wpdb->posts WHERE " . get_private_posts_cap_sql( 'post' ) . " GROUP BY post_author" ) as $row ) {
$author_count[$row->post_author] = $row->count;
}
foreach ( $authors as $author_id ) {
function __clear_multi_author_cache() {
delete_transient( 'is_multi_author' );
}
-add_action('transition_post_status', '__clear_multi_author_cache');