I would like to know which could be more performant between these two approaches of getting data of a post
-
To use a loop after a
WP_Query($aConditions)
and use functions likeget_the_title()
… and all the similar functions without passing any parameters -
To call
get_the_title($postID)
with the parameter outside the loop
They’re both doing the same thing. If you don’t pass a post ID,
get_the_title()
will just use the current post and go about it’s business. The performance difference between passing a postID and not passing a postID is, if anything at all, is extremely minor.get_the_title() Codex
get_the_title() Core Function