Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#12487 closed enhancement (wontfix)

Add 'got_posts' action to the query

Reported by: jfarthing84 Owned by: ryan
Milestone: Priority: normal
Severity: normal Version:
Component: Query Keywords: dev-feedback has-patch
Focuses: Cc:


I know this may be unusual, but I am working on a plugin that utilizes separate tables for it's own post types. The cool thing is that I am achieving this using ALL of the WP functions just by switching out the global variables to my own independent objects.

The only problem I've run across is with WP_Query::get_posts function. The final filter here is 'the_posts' which is called BEFORE the cache is updated. My situation also takes over the cache because if not, cached post numbers would collide from separate tables.

So, some kind of simple action at the end of WP_Query::get_posts before the posts are returned would be AWESOME! Then I can tell my plugin to switch back to the default WP objects at that point!

Attachments (1)

12487.diff (305 bytes) - added by jfarthing84 6 years ago.

Download all attachments as: .zip

Change History (5)

@jfarthing846 years ago

comment:1 @jfarthing846 years ago

  • Cc jeff@… added

comment:2 @jfarthing846 years ago

  • Keywords has-patch added

comment:3 @nacin6 years ago

  • Milestone changed from Unassigned to Future Release

comment:4 @jfarthing846 years ago

  • Milestone Future Release deleted
  • Resolution set to wontfix
  • Status changed from new to closed

You could actually close this, because I've found the proper hook which is called after the main query, which is simply 'wp'. Duh!

Note: See TracTickets for help on using tickets.