Advertisement
fauzanjeg

Get Comment Counter Without Cache

Aug 23rd, 2021
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.38 KB | None | 0 0
  1. /* Get Comment Counter Without Cache */
  2. function jnews_get_comments_number( $post_id = 0 ) {
  3.     delete_post_meta( get_the_ID(), 'jnews_comments_number' ); /* Delete Cache */
  4.     $comment         = JNews\Comment\CommentNumber::getInstance();
  5.     $comments_number = $comment->comments_number( $post_id );
  6.  
  7.     return apply_filters( 'jnews_get_comments_number', $comments_number, $post_id );
  8. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement