comments_number
doesn’t return the number of comments, it echos it out.
Use
get_comments_number()
to retrieve the value.
Related Posts:
- Change comments form title on a page by page basis
- How do I create comment-reply-button using element not
- Replace comment avatars and links at the same time
- Adding ads code between comments
- How do I fetch all comments per post via WP REST API?
- Ajax load more button for comments wordpress
- Limit 1 global comment per minute
- Create Page To Count Comments For Each Post In WordPress Site
- wp-comments-post.php file returns a blank page
- php function to display commenter username or login
- Alter required message using comment form api
- Send a mail to specific address in a custom field when a new comment is made on a specific post
- Fetching Initials of the Commentator in the WordPress Website
- comment_post (if comment is approved OR $comment_approved === 1) not working?
- Show all people who commented on all posts by an author
- How to get the rating value of each comment
- Trouble figuring out how to get my button to submit comment
- How to set and use global variables? Or why not to use them at all
- How to Add Image to WordPress RSS-Feed with no Plug-in?
- How to remove a metabox from menu editor page?
- Enqueue Javascript Correctly for 3.5
- How to add active class to custom menu using while loop and wp_list_pages
- Cleanest/Fastest way to avoid calling and retrieving data from the database multiple times?
- Add footer.php to WordPress child theme
- WooCommerce – Display variation custom field value [closed]
- Restrict WordPress File Type Uploads by User Type
- New Plugin Review
- Problems with function on function.php
- Woocommerce HTML email option unavailable
- Use template for posts with a particular category grandparent
- How to slow down server response
- Click loads template via ajax
- Function not working at one place
- How to remove or change the “W” icon in “My Sites”?
- How to prevent WP_Query function from returning all posts when empty?
- wp_trim_words() does not work with my code Am I doing any mistake in my code?
- Woocommerce: hook action/filter I could use to add variation id and price with each attribute opt on WooCommerce Rest api
- foreach loop still echoes array
- dynamic dependent select dropdown
- Generating an nonce for Content Security Policy and all scripts – How to make it match/persist for each page load?
- getting logged in user info (wp-load.php) from parent directory
- Add .htm extention to a custom taxonomy
- Custom gallery in wp3.5
- Noscript not working as it should in wordpress site
- How to use theme function in post/page?
- esc_url( ) won’t use https
- Removing the comment function within wordpress
- Content filter won’t work
- Where is this function’s callback getting its arguments from?
- Why does the post_type_link hook everything twice?
- Warning: in_array() null given in PHP function
- Use post ID in functions.php file adminside
- How to: Conditionally Enqueue JS and Stylesheets, for Custom Post Type (Single and Archive Templates)
- use loop to return blog details
- How can I count ACF sub_field with a certain value
- change the default order of posts only for specific categories
- Adding function to child theme’s function.php
- Custom posts password protect
- How to get post category list as select in front-end?
- How to use functions [closed]
- Extract and display user infromation on an automatically created page
- Is it legal to redefine wp_password_change_notification in a mu plugin?
- Conditionally load class in the comment section of the post page
- How can I assign separate stylesheets to different pages?
- Function to call either single post or category
- WP Container Displaying Only on First Page of Archive
- Updating Metadata with Shortcode
- can’t load .po file in functions.php
- Woocommerce – Exclude variation attribute on specific variation
- How do I add a function to parent theme
- Are there any drawbacks on opening a session_start in functions.php and header.php?
- Add Pre-Defined Value to Click Counter in WordPress
- How to move a post from one category to another
- Show data obtained from a function and place it in a shortocode function
- How to override theme’s public static function inside of a trait?
- Delete empty title_tags, find a h1 heading and echo it
- how to use 2 index.php file One for mobile and one for desktop
- WP_Query To Display Product Of Brand On Taxonomy Page
- ajaxurl usage for a custom function
- oembed facebook link?
- Open/closed function [closed]
- How can I export data without using any import/export plugin
- Search for images that width and height is more than 500
- add a value to an external link query in searchform
- Add disclaimer before certain posts and pages
- How do I routinely extract the thumbnail of the most recent post?
- wordpress ajax return 0
- My customizer’s setting doesn’t set to the default and needed to click the control’s “Default” button before it’ll be set
- site_url() returns with additional backslashes
- Overwriting a Shortcode
- WordPress – show number of comments for each post in widget
- Search box background on a different page template
- WP Ecommerce: Display the “Order Notes” as column in the Sales Log [closed]
- WordPress most commented posts of last X days
- A next page function with shortcode?
- What is the wrong with this function to enqueue the scripts and styles to the theme? [closed]
- Warning: Attempt to read property “term_id” on int – Woocommerce
- Understanding responsive imagery
- How to get meta box labels?
- Tags being Inserted in html from plugin PHP not passing through the_content