Make WordPress Core

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's profile brokentone Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.6
Component: Query Keywords: close
Focuses: Cc:

Description (last modified by boonebgorges)

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)

#1 @boonebgorges
9 years ago

  • Description modified (diff)

#2 @boonebgorges
9 years ago 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 a WP_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 of get_posts() clearer.

#3 @knutsp
9 years ago

  • Keywords close added

Not a bug. We have learned to depend on this difference, in our plugins and themes.

This ticket was mentioned in Slack in #core by jorbin. View the logs.

9 years ago

#5 @jorbin
9 years ago

  • Version changed from trunk to 2.6

#6 @wonderboymusic
9 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.