Make WordPress Core

Opened 9 years ago

Last modified 5 years ago

#34546 new enhancement

Change in function `get_post_field`

Reported by: sebastianpisula's profile sebastian.pisula Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Posts, Post Types Keywords:
Focuses: Cc:

Description

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 ) );
}

Attachments (1)

34546.patch (1.3 KB) - added by sebastian.pisula 9 years ago.

Download all attachments as: .zip

Change History (3)

#1 @SergeyBiryukov
9 years ago

  • Component changed from General to Posts, Post Types

#2 @DrewAPicture
8 years ago

#35949 was marked as a duplicate.

Note: See TracTickets for help on using tickets.