[wp-trac] [WordPress Trac] #37059: Allow post to be passed to get_the_modified_time & get_the_modified_date

WordPress Trac noreply at wordpress.org
Sun Jun 26 10:53:53 UTC 2016


#37059: Allow post to be passed to get_the_modified_time & get_the_modified_date
-------------------------------------------------+-------------------------
 Reporter:  peterwilsoncc                        |       Owner:
     Type:  enhancement                          |  peterwilsoncc
 Priority:  normal                               |      Status:  reopened
Component:  Posts, Post Types                    |   Milestone:  4.6
 Severity:  normal                               |     Version:
 Keywords:  good-first-bug has-patch has-unit-   |  Resolution:
  tests                                          |     Focuses:
-------------------------------------------------+-------------------------

Comment (by peterwilsoncc):

 Replying to [comment:16 sebastian.pisula]:
 > I think that in get_the_modified_date() this code
 > {{{
 > $post = get_post( $post );
 >
 >       if ( ! $post ) {
 >               return false;
 >       }
 > }}}
 >
 > is unnecessary because in get_post_modified_time check valid $variable
 and function get_post_modified_time() is called always

 I'm going to keep the `! $post` check in both `get_the_modified_date` and
 `get_the_modified_time`. You're correct, `get_post_modified_time` does the
 same check but when the outcome of a function call is easily premepted it
 can be bypassed.

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


More information about the wp-trac mailing list