3

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 like get_the_title() ... and all the similar functions without passing any parameters

  • To call get_the_title($postID) with the parameter outside the loop

0

1 Answer 1

3

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.