Make WordPress Core

Ticket #55503: 55503.1.patch

File 55503.1.patch, 973 bytes (added by jariwalasagar, 3 years ago)

Instead of add static Date/Time format, We can use previous stored data if custom formats are null.

  • src/wp-admin/options.php

     
    265265                if ( ! empty( $_POST['date_format'] ) && isset( $_POST['date_format_custom'] )
    266266                        && '\c\u\s\t\o\m' === wp_unslash( $_POST['date_format'] )
    267267                ) {
    268                         $_POST['date_format'] = $_POST['date_format_custom'];
     268                        $_POST['date_format'] = !empty( $_POST['date_format_custom'] ) ? $_POST['date_format_custom'] : get_option('date_format');
    269269                }
    270270
    271271                if ( ! empty( $_POST['time_format'] ) && isset( $_POST['time_format_custom'] )
    272272                        && '\c\u\s\t\o\m' === wp_unslash( $_POST['time_format'] )
    273273                ) {
    274                         $_POST['time_format'] = $_POST['time_format_custom'];
     274                        $_POST['time_format'] = !empty( $_POST['time_format_custom'] ) ? $_POST['time_format_custom'] : get_option('time_format');
    275275                }
    276276
    277277                // Map UTC+- timezones to gmt_offsets and set timezone_string to empty.