[wp-trac] [WordPress Trac] #26877: Allow get_post() to accept a custom post object instead of only WP_Post

WordPress Trac noreply at wordpress.org
Fri Oct 10 10:16:55 UTC 2014


#26877: Allow get_post() to accept a custom post object instead of only WP_Post
------------------------------------+-----------------------------
 Reporter:  MikeSchinkel            |       Owner:
     Type:  enhancement             |      Status:  new
 Priority:  normal                  |   Milestone:  Future Release
Component:  Posts, Post Types       |     Version:
 Severity:  normal                  |  Resolution:
 Keywords:  has-patch dev-feedback  |     Focuses:
------------------------------------+-----------------------------

Comment (by dbisso):

 This would have been really useful to me on a recent client project that
 needed a number of custom post types with additional methods and
 properties (e.g an event post object with
 {{{$event_post->get_start_date()}}} /
 {{{$event_post->get_next_occurrence()}}} methods etc). I resorted to a
 similar workaround as the OP, but had the same problem of getting
 {{{get_post}}} to accept the new object.

 Ideally, I would love to see this included in 4.1 with #12955 which would
 allow a single, universal place to filter or replace post objects with
 custom classes.

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


More information about the wp-trac mailing list