Make WordPress Core

Ticket #34546: 34546.patch

File 34546.patch, 1.3 KB (added by sebastian.pisula, 9 years ago)
  • wp-includes/post-functions.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    499499 * @see sanitize_post_field()
    500500 *
    501501 * @param string      $field   Post field name.
    502  * @param int|WP_Post $post    Post ID or post object.
     502 * @param int|WP_Post $post    Optional. Post ID or post object. Default: null
    503503 * @param string      $context Optional. How to filter the field. Accepts 'raw', 'edit', 'db',
    504504 *                             or 'display'. Default 'display'.
     505 * @param mixed       $default Optional. Default value.
    505506 * @return string The value of the post field on success, empty string on failure.
    506507 */
    507 function get_post_field( $field, $post, $context = 'display' ) {
     508function get_post_field( $field, $post = null, $context = 'display', $default = '' ) {
    508509        $post = get_post( $post );
    509510
    510         if ( !$post )
    511                 return '';
    512 
    513         if ( !isset($post->$field) )
    514                 return '';
     511        if ( !$post || !isset($post->$field) )
     512                return $default;
    515513
    516514        return sanitize_post_field($field, $post->$field, $post->ID, $context);
    517515}