[wp-trac] [WordPress Trac] #35949: Default value in `get_post_field`

WordPress Trac noreply at wordpress.org
Thu Feb 25 13:16:57 UTC 2016


#35949: Default value in `get_post_field`
------------------------------+-----------------------------
 Reporter:  sebastian.pisula  |      Owner:
     Type:  enhancement       |     Status:  new
 Priority:  normal            |  Milestone:  Awaiting Review
Component:  General           |    Version:
 Severity:  normal            |   Keywords:
  Focuses:                    |
------------------------------+-----------------------------
 I think that get_post_field() function should have param with default
 value.

 Why ?

 For example in feature I can change other functions:

 {{{#!php
 <?php
 function get_post_mime_type( $ID = '' ) {
         return get_post_field('post_mime_type', $ID, 'display', false);
 }
 }}}

 Previous version:

 {{{#!php
 <?php
 function get_post_mime_type( $ID = '' ) {
         $post = get_post($ID);

         if ( is_object($post) )
                 return $post->post_mime_type;

         return false;
 }
 }}}

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


More information about the wp-trac mailing list