if you\'re on a single post, it will return the post object
if you\'re on a page, it will return the page object
if you\'re on an archive page, it will return the post type object
if you\'re on a category archive, it will return the category object
if you\'re on an author archive, it will return the author object
etc.
使用
query-object 按照@terminator的建议
代替使用sql查询使用count_user_posts
$queried_object = get_queried_object();
count_user_posts($queried_object->ID, \'custom_post_type_here\');