WordPress.org

Make WordPress Core

Ticket #43360: 43360.patch

File 43360.patch, 916 bytes (added by farhan.noor, 4 years ago)

Patch

  • option.php

     
    2525 *
    2626 * @param string $option  Name of option to retrieve. Expected to not be SQL-escaped.
    2727 * @param mixed  $default Optional. Default value to return if the option does not exist.
     28 * @param bool  $return_null Optional. Return default value if the option exist with empty string, empty array or null value.
    2829 * @return mixed Value set for the option.
    2930 */
    30 function get_option( $option, $default = false ) {
     31function get_option( $option, $default = false, $return_null = true ) {
    3132        global $wpdb;
    3233
    3334        $option = trim( $option );
     
    136137                $value = untrailingslashit( $value );
    137138        }
    138139
     140        if(empty($value) && false === $return_null)
     141                $value = $default;
    139142        /**
    140143         * Filters the value of an existing option.
    141144         *