Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#35949 closed enhancement (duplicate)

Default value in `get_post_field`

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

Description

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

Why ?

For example in feature I can change other functions:

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

Previous version:

<?php
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 9 years ago.

Download all attachments as: .zip

Change History (5)

#1 @swissspidy
9 years ago

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

#2 @ocean90
9 years ago

The same was proposed in #34546.

#3 @sebastian.pisula
9 years ago

hmm, yeah :D this is my patch oO

I forgot :(

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

#4 @DrewAPicture
9 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.