[wp-trac] [WordPress Trac] #37316: Allow WP_Post to be filtered at instantiation

WordPress Trac noreply at wordpress.org
Fri Jul 8 17:04:11 UTC 2016


#37316: Allow WP_Post to be filtered at instantiation
-----------------------------+-----------------------------
 Reporter:  jason_the_adams  |      Owner:
     Type:  enhancement      |     Status:  new
 Priority:  normal           |  Milestone:  Awaiting Review
Component:  Query            |    Version:  trunk
 Severity:  normal           |   Keywords:
  Focuses:                   |
-----------------------------+-----------------------------
 Currently it's possible to filter the results of `wp_query->get_posts`
 using either the 'posts_results' or 'the_posts' filters. There's no way to
 filter the results of the `get_post` function, however.

 Providing a filter for when a WP_Post is instantiated would allow
 themes/plugins with custom post types to add properties and such when the
 post(s) are retrieved. Currently wrapper functions such as get_event_post
 have to be made. It would be great if the standard WordPress functions
 could be used and CPT results reliably structured.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/37316>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list