I'm running the following PHP Code Sniffs on some WordPress code, and the following warning pops up
352 | WARNING | get_posts is discouraged in favor of creating a new | | WP_Query() so that Advanced Post Cache will cache | | the query, unless you explicitly supply | | suppress_filters => false.
While I'm an experienced programmer, I'm not super familiar with WordPress's history. This warning seems important, but is awkwardly worded. I'm confused on a few points, and other answers I've found on the subject don't seem to address my points.
What is the "Advanced Post Cache". I know WordPress (like a lot of PHP applications) has caching going on at a few different levels.
Is this warning telling me that
get_postswill never use the cache, but
Is this warning telling me that using
WP_Querywill bypass the Advanced Post Cache? Or that using
get_postswill invoke the cache? Or something else?
What else does
If someone more familiar with the matter could clue in a WordPress newb I'd appreciate it. I'm not looking for a "always use X, or never use Y" sort of answer -- I'm trying to understand the tradeoffs of each approach.