WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 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:

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 5 years ago.

Download all attachments as: .zip

Change History (5)

#1 @swissspidy
5 years ago

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

#2 @ocean90
5 years ago

The same was proposed in #34546.

#3 @sebastian.pisula
5 years ago

hmm, yeah :D this is my patch oO

Version 0, edited 5 years ago by sebastian.pisula (next)

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