[wp-trac] [WordPress Trac] #12955: Add get_post filter

WordPress Trac noreply at wordpress.org
Fri Jul 8 20:12:11 UTC 2016


#12955: Add get_post filter
------------------------------------+-----------------------------
 Reporter:  JohnLamansky            |       Owner:
     Type:  feature request         |      Status:  new
 Priority:  normal                  |   Milestone:  Future Release
Component:  Posts, Post Types       |     Version:
 Severity:  normal                  |  Resolution:
 Keywords:  has-patch dev-feedback  |     Focuses:
------------------------------------+-----------------------------

Comment (by jason_the_adams):

 Want to throw in my support for this. I'd be happy with either a filter,
 as the ticket suggests, or the ability to define a subclass as @dd32
 mentions. I have some classes that I wrap around WP_Post, WP_User, and
 WP_Term in a plugin I made, with the idea that it's easy to subclass the
 Post class for a post type or page template. When `get_post_controller`
 (get_post wrapper), it grabs the corresponding class based on the post's
 template/type. This is done by looking for a static property of the class
 ($post_type/$page_template, which can be an array), and falls back on the
 base Post class. You can check out the source here:
 https://github.com/JasonTheAdams/WP-Controllers

 I say all that just as food for thought on how subclasses could be
 introduced and retrieved via get_post. I'm still open to the filter idea,
 however, and believe it's up to the developer to know when is the best
 time to use each filter.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/12955#comment:39>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list