Opened 9 years ago
Closed 9 years ago
#32601 closed defect (bug) (wontfix)
Use of suppress_filters inconsistent between get_posts() and WP_Query->get_posts()
Reported by: | brokentone | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 2.6 |
Component: | Query | Keywords: | close |
Focuses: | Cc: |
Description (last modified by )
In #7326 [8795] ryan added defaults for suppress_filters, however, they are set opposite for the two similarly named function / methods (get_posts() and WP_Query->get_posts()). One would expect calls to the two similarly named functions to work similarly. I really don't get the default behavior of disallowing nearly all (but not all) filters, and has caused us substantial headache in debugging code.
I would ask that we set the default of get_posts suppress_filters to false rather than true.
Change History (6)
Note: See
TracTickets for help on using
tickets.
https://core.trac.wordpress.org/ticket/7326#comment:22 is the closest I can find to an explanation for the behavior. I don't really understand the reasoning.
In any case, it's been like this for many years, and for many years, one of the mantras of using
get_posts()
has been that it differs from aWP_Query
object in that filters are suppressed. Changing this behavior would likely cause lots of backward compatibility problems. The best we can do is to improve the documentation to make this aspect ofget_posts()
clearer.