get_comments_number WordPress Filter Hook

The get_comments_number hook is used to get the number of comments for a post. This can be useful for displaying the number of comments next to the post title, or for creating a custom callback function to display the number of comments in a different way.

apply_filters( 'get_comments_number', string|int $count, int $post_id ) #

Filters the returned comment count for a post.


Parameters

$count

(string|int)A string representing the number of comments a post has, otherwise 0.

$post_id

(int)Post ID.


Top ↑

Source

File: wp-includes/comment-template.php

View on Trac



Top ↑

Changelog

Changelog
VersionDescription
1.5.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More