Make WordPress Core

Ticket #55503: 55503.patch

File 55503.patch, 1.0 KB (added by rishishah, 3 years ago)

Applied patch to add default value if anyone kept blank Date and Time format field.

  • src/wp-admin/options.php

    diff --git a/src/wp-admin/options.php b/src/wp-admin/options.php
    index 84ac775fd43d8a5a5e7543029825d3345e4e3be9..2d607ebbeb0fac4289cb097e67e5ccdab08c60bb 100644
    a b if ( 'update' === $action ) { // We are saving settings sent from a settings pag 
    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'] : 'F j, Y';
    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'] : 'g:i a';
    275275                }
    276276
    277277                // Map UTC+- timezones to gmt_offsets and set timezone_string to empty.