This is that classic question, do you have 6 eggs or half a dozen, and frankly, it doesn’t actually matter.
It is however better to use get_comments_number()
because
-
the post object is retrieved from the
$GLOBALS['post']
global which is set bythe_post()
inside the loop -
the post object is validated through
WP_Post
(throughget_post()
) -
the output from
get_comments_number()
is filterable should you later need to filter the output
Related Posts:
- How to implement a WordPress comments function?
- how to show comments only author which send own posts in wordpress
- I want to change the WordPress comments file
- I need some explanation on global $post [duplicate]
- Is it possible to paste a link without tags and make it directly a link in a post?
- Showing author page if user has no post
- How to assign classes to all elements?
- Display post x of y within category
- Force authors to Preview a post before publishing
- WordPress Automatic Filename Changer
- Customizing Comments on Posts
- WordPress Comment posting problem
- What do comments with […] mean?
- Order posts alphabetically: how to set order=asc in mysql query?
- What do these phpMyAdmin errors mean on my WordPress databaes?
- Internal post link creates comments on its own
- How to get posts and comments amount per hour, per year and per month?
- Show comment number per author per day
- Get all comments of author’s posts
- Change all author links in Blog roll
- SQL Command for restoring trashed comments
- disable Tab post on nav-menus page (Admin)
- Add a variable in a post
- Howto show comment count by post in post?
- Adding bootstrap classes to video shortcodes
- How do you change the comment count in the back end posts list, to reflect unapproved comments, rather than all comments?
- Every second post different class in blog view
- Format latest/newest post differently
- is_page Funtion for Posts ?
- Post type no single page
- Hide comments and posts posted by other user
- Let both the admin and post author update comment meta
- Get post meta retrieving wrong value
- Adding a user’s ID behind the tag ref link address
- The_excerpt() doesn’t parse – how to change that?
- How to only publish posts with image in it
- Isn’t the way posts are displayed very unefficient?
- What’s the safest way to switch and restore a post global?
- Add custom text automatically on each post
- How to check in functions.php if there is data in a WP_Query?
- How to style archive post titles… but only those posts who have comments?
- restrict incrementation of post vies count when refreshing the page
- Defined function isn’t showed on page
- WordPress 302 Redirect to Random Product/Post/Page
- Getting Whitescreen when publishing a post [closed]
- Using system date format
- Get post by tag
- Add code to a specific post’s content
- Related Posts function not working
- the_content() Not Grabbing All Content
- Un-highlight Blog Menu Item when Category Menu Item is Selected
- Detecting current page from class method
- Retrieve post in AJAX Callback
- How does WP decide how to display a page
- Related Posts: Changing Function For Posts Per Page
- Display on page every post in blog WITH comments
- Query function not executed between element [closed]
- Optimize CPT-function with a loop
- Showing recent post of category in page
- Can WordPress handle following functionalities?
- saving/reading custom field value does not work – no value gets POSTed
- Same post appears in related Posts?
- Internal linking to posts permalink fail because of spaces and stripe at postname
- If post exists, make it a comment in existing post with same name?
- Have h2 tag not show up if there are no blog posts
- WordPress as CMS: How to manage/handle images assigned to a post as full-sized background images in a slideshow?
- Making a wordpress page print friendly
- How to get post id of last approved comment?
- Help on conditional statement to accompany wp_insert_post function please?
- How to add content above footer in posts from specific category
- How can I globally italicize list of texts in the UI database or Posts? [closed]
- Set Default Post as Parent Child (Nested) Relation
- Allow / show post comments in category pages
- I need to create “View Profile” and “Edit Profile” links by incorporating the Post Title/ID, but can’t seem to manage it
- Count the total views of all user posts published
- Shortcode for Comments and Comment Boxes in Post Loop
- Merge get_comments & get_posts into a single query
- get category in list of posts // shortcode for custom related posts
- shortcode // get posts by ids
- How to put the author of the post in the comments?
- Check if almost 10 year old – working code is up to date
- Alt text attributes not showing over portfolio images
- Custom global variable not working in function
- Find most used words in post titles
- WordPress Sticky Post Count “Fix” Breaking Pagecount by 72 pages!
- $post->post_content empty while all other properties are correct
- Function is printing twice – any suggestions?
- How to add a custom class attribute into code wrapper? [duplicate]
- Remove the URL author of post on all comments
- Remove pagination if search returns empty
- Remove HTML tags from all posts
- Set a post expiration and delete a post when expirate
- How to access custom class methods from any include without using global
- WordPress weird behaviour on comments
- Comments are in database, don’t show up in WordPress backend or frontend
- No comments allowed
- Replace Tag Keyword With Link Within Post Content
- Excluding tag Link from html tags in Post content
- Save All Post Permalink From A Specific Category into a .txt file
- Changing a users posts to drafts upon role change