Make WordPress Core

Opened 10 years ago

Closed 10 years ago

#26943 closed enhancement (invalid)

The comment_text() function retrieve the comment text 2 times

Reported by: alexvorn2's profile alexvorn2 Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Comments Keywords:
Focuses: Cc:


The comment_text() function loads two function that retrieves the comment, so I think It should retrieve only one...

See the function here:

function comment_text( $comment_ID = 0, $args = array() ) {
	$comment = get_comment( $comment_ID );

	$comment_text = get_comment_text( $comment_ID , $args );

	echo apply_filters( 'comment_text', $comment_text, $comment, $args );

what get_comment_text() does?:

function get_comment_text( $comment_ID = 0, $args = array() ) {
	$comment = get_comment( $comment_ID );

	return apply_filters( 'get_comment_text', $comment->comment_content, $comment, $args );

So if you see the get_comment() is called twice...

Change History (1)

#1 @helen
10 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

Given that the whole $comment object is passed as context to the filters, I don't see that working out. It's cached anyway, doesn't hit the DB twice.

Note: See TracTickets for help on using tickets.