Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#35949 closed enhancement (duplicate)

Default value in `get_post_field`

Reported by: sebastian.pisula Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Posts, Post Types Keywords: has-patch
Focuses: Cc:


I think that get_post_field() function should have param with default value.

Why ?

For example in feature I can change other functions:

function get_post_mime_type( $ID = '' ) {
        return get_post_field('post_mime_type', $ID, 'display', false);

Previous version:

function get_post_mime_type( $ID = '' ) {
        $post = get_post($ID);

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

        return false;

Attachments (1)

35949.patch (1.2 KB) - added by sebastian.pisula 6 years ago.

Download all attachments as: .zip

Change History (5)

#1 @swissspidy
6 years ago

  • Component changed from General to Posts, Post Types
  • Keywords has-patch added

#2 @ocean90
6 years ago

The same was proposed in #34546.

#3 @sebastian.pisula
6 years ago

hmm, yeah :D this is my patch oO

I forgot :(

Last edited 6 years ago by sebastian.pisula (previous) (diff)

#4 @DrewAPicture
6 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #34546.

Note: See TracTickets for help on using tickets.