[wp-trac] [WordPress Trac] #34546: Change in function `get_post_field`

WordPress Trac noreply at wordpress.org
Sun Nov 1 18:35:53 UTC 2015


#34546: Change in function `get_post_field`
------------------------------+-----------------------------
 Reporter:  sebastian.pisula  |      Owner:
     Type:  enhancement       |     Status:  new
 Priority:  normal            |  Milestone:  Awaiting Review
Component:  General           |    Version:
 Severity:  normal            |   Keywords:
  Focuses:                    |
------------------------------+-----------------------------
 I suggest change for function get_post_field();

 1. Second param should be optional;
 2. Add default value in param of function.

 Additional I have question. Why in function get_the_ID() or
 get_post_title(); don't call  function get_post_field ?

 In many functions in first line is $post = get_post( $post );

 If we insert my patch then we can use:


 {{{
 function get_the_ID() {
         return get_post_field('ID', null, 'display', false);
 }
 }}}


 OR


 {{{
 function get_the_guid( $id = 0 ) {
         return apply_filters( 'get_the_guid', get_post_field( 'guid', $id
 ) );
 }
 }}}

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


More information about the wp-trac mailing list