[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-admin/ -> options-general.php (source)

   1  <?php
   2  /**
   3   * General settings administration panel.
   4   *
   5   * @package WordPress
   6   * @subpackage Administration
   7   */
   8  
   9  /** WordPress Administration Bootstrap */
  10  require_once  __DIR__ . '/admin.php';
  11  
  12  /** WordPress Translation Installation API */
  13  require_once  ABSPATH . 'wp-admin/includes/translation-install.php';
  14  
  15  if ( ! current_user_can( 'manage_options' ) ) {
  16      wp_die( __( 'Sorry, you are not allowed to manage options for this site.' ) );
  17  }
  18  
  19  // Used in the HTML title tag.
  20  $title       = __( 'General Settings' );
  21  $parent_file = 'options-general.php';
  22  /* translators: Date and time format for exact current time, mainly about timezones, see https://www.php.net/manual/datetime.format.php */
  23  $timezone_format = _x( 'Y-m-d H:i:s', 'timezone date format' );
  24  
  25  $new_admin_email         = get_option( 'new_admin_email' );
  26  $pending_new_admin_email = $new_admin_email && get_option( 'admin_email' ) !== $new_admin_email;
  27  
  28  add_action( 'admin_head', 'options_general_add_js' );
  29  
  30  $options_help = '<p>' . __( 'The fields on this screen determine some of the basics of your site setup.' ) . '</p>' .
  31      '<p>' . __( 'Most themes show the site title at the top of every page, in the title bar of the browser, and as the identifying name for syndicated feeds. Many themes also show the tagline.' ) . '</p>';
  32  
  33  if ( ! is_multisite() ) {
  34      $options_help .= '<p>' . __( 'Two terms you will want to know are the WordPress URL and the site URL. The WordPress URL is where the core WordPress installation files are, and the site URL is the address a visitor uses in the browser to go to your site.' ) . '</p>' .
  35          '<p>' . sprintf(
  36              /* translators: %s: Documentation URL. */
  37              __( 'Though the terms refer to two different concepts, in practice, they can be the same address or different. For example, you can have the core WordPress installation files in the root directory (<code>https://example.com</code>), in which case the two URLs would be the same. Or the <a href="%s">WordPress files can be in a subdirectory</a> (<code>https://example.com/wordpress</code>). In that case, the WordPress URL and the site URL would be different.' ),
  38              __( 'https://developer.wordpress.org/advanced-administration/server/wordpress-in-directory/' )
  39          ) . '</p>' .
  40          '<p>' . sprintf(
  41              /* translators: 1: http://, 2: https:// */
  42              __( 'Both WordPress URL and site URL can start with either %1$s or %2$s. A URL starting with %2$s requires an SSL certificate, so be sure that you have one before changing to %2$s. With %2$s, a padlock will appear next to the address in the browser address bar. Both %2$s and the padlock signal that your site meets some basic security requirements, which can build trust with your visitors and with search engines.' ),
  43              '<code>http://</code>',
  44              '<code>https://</code>'
  45          ) . '</p>' .
  46          '<p>' . __( 'If you want site visitors to be able to register themselves, check the membership box. If you want the site administrator to register every new user, leave the box unchecked. In either case, you can set a default user role for all new users.' ) . '</p>';
  47  }
  48  
  49  $options_help .= '<p>' . __( 'You can set the language, and WordPress will automatically download and install the translation files (available if your filesystem is writable).' ) . '</p>' .
  50      '<p>' . __( 'UTC means Coordinated Universal Time.' ) . '</p>' .
  51      '<p>' . __( 'You must click the Save Changes button at the bottom of the screen for new settings to take effect.' ) . '</p>';
  52  
  53  get_current_screen()->add_help_tab(
  54      array(
  55          'id'      => 'overview',
  56          'title'   => __( 'Overview' ),
  57          'content' => $options_help,
  58      )
  59  );
  60  
  61  get_current_screen()->set_help_sidebar(
  62      '<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
  63      '<p>' . __( '<a href="https://wordpress.org/documentation/article/settings-general-screen/">Documentation on General Settings</a>' ) . '</p>' .
  64      '<p>' . __( '<a href="https://wordpress.org/support/forums/">Support forums</a>' ) . '</p>'
  65  );
  66  
  67  require_once  ABSPATH . 'wp-admin/admin-header.php';
  68  ?>
  69  
  70  <div class="wrap">
  71  <h1><?php echo esc_html( $title ); ?></h1>
  72  
  73  <?php
  74  if ( isset( $_GET['admin_email_updated'] ) ) {
  75      $message = '<strong>' . __( 'Administration email updated.' ) . '</strong>';
  76      wp_admin_notice(
  77          $message,
  78          array(
  79              'id'          => 'message',
  80              'dismissible' => true,
  81              'type'        => 'success',
  82          )
  83      );
  84  }
  85  
  86  $pending_admin_email_cancel_request_link = sprintf(
  87      ' <a href="%1$s">%2$s</a>',
  88      esc_url( wp_nonce_url( admin_url( 'options.php?dismiss=new_admin_email' ), 'dismiss-' . get_current_blog_id() . '-new_admin_email' ) ),
  89      _x( 'Cancel request', 'admin email change' )
  90  );
  91  
  92  if ( $pending_new_admin_email ) {
  93      $message = sprintf(
  94          /* translators: %s: New administration email address. */
  95          __( 'The administration email address has not been updated yet. Please check the inbox at %s for a confirmation email.' ),
  96          '<code>' . esc_html( $new_admin_email ) . '</code>'
  97      );
  98      $message .= $pending_admin_email_cancel_request_link;
  99      wp_admin_notice( $message, array( 'type' => 'info' ) );
 100  }
 101  ?>
 102  
 103  <form method="post" action="options.php" novalidate="novalidate">
 104  <?php settings_fields( 'general' ); ?>
 105  
 106  <table class="form-table" role="presentation">
 107  
 108  <tr>
 109  <th scope="row"><label for="blogname"><?php _e( 'Site Title' ); ?></label></th>
 110  <td><input name="blogname" type="text" id="blogname" value="<?php form_option( 'blogname' ); ?>" class="regular-text" /></td>
 111  </tr>
 112  
 113  <?php
 114  if ( ! is_multisite() ) {
 115      /* translators: Site tagline. */
 116      $sample_tagline = __( 'Just another WordPress site' );
 117  } else {
 118      /* translators: %s: Network title. */
 119      $sample_tagline = sprintf( __( 'Just another %s site' ), get_network()->site_name );
 120  }
 121  $tagline_description = sprintf(
 122      /* translators: %s: Site tagline example. */
 123      __( 'In a few words, explain what this site is about. Example: &#8220;%s.&#8221;' ),
 124      $sample_tagline
 125  );
 126  ?>
 127  <tr>
 128  <th scope="row"><label for="blogdescription"><?php _e( 'Tagline' ); ?></label></th>
 129  <td><input name="blogdescription" type="text" id="blogdescription" aria-describedby="tagline-description" value="<?php form_option( 'blogdescription' ); ?>" class="regular-text" />
 130  <p class="description" id="tagline-description"><?php echo $tagline_description; ?></p></td>
 131  </tr>
 132  
 133  <?php if ( current_user_can( 'upload_files' ) ) : ?>
 134  <tr class="hide-if-no-js site-icon-section">
 135  <th scope="row"><?php _e( 'Site Icon' ); ?></th>
 136  <td>
 137      <?php
 138      wp_enqueue_media();
 139      wp_enqueue_script( 'site-icon' );
 140  
 141      $classes_for_upload_button = 'upload-button button-hero button';
 142      $classes_for_update_button = 'button';
 143      $classes_for_wrapper       = '';
 144  
 145      if ( has_site_icon() ) {
 146          $classes_for_wrapper         .= ' has-site-icon';
 147          $classes_for_button           = $classes_for_update_button;
 148          $classes_for_button_on_change = $classes_for_upload_button;
 149      } else {
 150          $classes_for_wrapper         .= ' hidden';
 151          $classes_for_button           = $classes_for_upload_button;
 152          $classes_for_button_on_change = $classes_for_update_button;
 153      }
 154  
 155      // Handle alt text for site icon on page load.
 156      $site_icon_id           = (int) get_option( 'site_icon' );
 157      $app_icon_alt_value     = '';
 158      $browser_icon_alt_value = '';
 159  
 160      $site_icon_url = get_site_icon_url();
 161  
 162      if ( $site_icon_id ) {
 163          $img_alt            = get_post_meta( $site_icon_id, '_wp_attachment_image_alt', true );
 164          $filename           = wp_basename( $site_icon_url );
 165          $app_icon_alt_value = sprintf(
 166              /* translators: %s: The selected image filename. */
 167              __( 'App icon preview: The current image has no alternative text. The file name is: %s' ),
 168              $filename
 169          );
 170  
 171          $browser_icon_alt_value = sprintf(
 172              /* translators: %s: The selected image filename. */
 173              __( 'Browser icon preview: The current image has no alternative text. The file name is: %s' ),
 174              $filename
 175          );
 176  
 177          if ( $img_alt ) {
 178              $app_icon_alt_value = sprintf(
 179                  /* translators: %s: The selected image alt text. */
 180                  __( 'App icon preview: Current image: %s' ),
 181                  $img_alt
 182              );
 183  
 184              $browser_icon_alt_value = sprintf(
 185                  /* translators: %s: The selected image alt text. */
 186                  __( 'Browser icon preview: Current image: %s' ),
 187                  $img_alt
 188              );
 189          }
 190      }
 191      ?>
 192  
 193      <style>
 194      :root {
 195          --site-icon-url: url( '<?php echo esc_url( $site_icon_url ); ?>' );
 196      }
 197      </style>
 198  
 199      <div id="site-icon-preview" class="site-icon-preview settings <?php echo esc_attr( $classes_for_wrapper ); ?>">
 200          <div class="direction-wrap">
 201              <img id="app-icon-preview" src="<?php echo esc_url( $site_icon_url ); ?>" class="app-icon-preview" alt="<?php echo esc_attr( $app_icon_alt_value ); ?>" />
 202              <div class="site-icon-preview-browser">
 203                  <svg role="img" aria-hidden="true" fill="none" xmlns="http://www.w3.org/2000/svg" class="browser-buttons"><path fill-rule="evenodd" clip-rule="evenodd" d="M0 20a6 6 0 1 1 12 0 6 6 0 0 1-12 0Zm18 0a6 6 0 1 1 12 0 6 6 0 0 1-12 0Zm24-6a6 6 0 1 0 0 12 6 6 0 0 0 0-12Z" /></svg>
 204                  <div class="site-icon-preview-tab">
 205                      <img id="browser-icon-preview" src="<?php echo esc_url( $site_icon_url ); ?>" class="browser-icon-preview" alt="<?php echo esc_attr( $browser_icon_alt_value ); ?>" />
 206                      <div class="site-icon-preview-site-title" id="site-icon-preview-site-title" aria-hidden="true"><?php bloginfo( 'name' ); ?></div>
 207                          <svg role="img" aria-hidden="true" fill="none" xmlns="http://www.w3.org/2000/svg" class="close-button">
 208                              <path d="M12 13.0607L15.7123 16.773L16.773 15.7123L13.0607 12L16.773 8.28772L15.7123 7.22706L12 10.9394L8.28771 7.22705L7.22705 8.28771L10.9394 12L7.22706 15.7123L8.28772 16.773L12 13.0607Z" />
 209                          </svg>
 210                      </div>
 211                  </div>
 212              </div>
 213          </div>
 214      </div>
 215  
 216      <input type="hidden" name="site_icon" id="site_icon_hidden_field" value="<?php form_option( 'site_icon' ); ?>" />
 217      <div class="site-icon-action-buttons">
 218          <button type="button"
 219              id="choose-from-library-button"
 220              class="<?php echo esc_attr( $classes_for_button ); ?>"
 221              data-alt-classes="<?php echo esc_attr( $classes_for_button_on_change ); ?>"
 222              data-size="512"
 223              data-choose-text="<?php esc_attr_e( 'Choose a Site Icon' ); ?>"
 224              data-update-text="<?php esc_attr_e( 'Change Site Icon' ); ?>"
 225              data-update="<?php esc_attr_e( 'Set as Site Icon' ); ?>"
 226              data-state="<?php echo has_site_icon() ? '1' : ''; ?>"
 227  
 228          >
 229              <?php if ( has_site_icon() ) : ?>
 230                  <?php _e( 'Change Site Icon' ); ?>
 231              <?php else : ?>
 232                  <?php _e( 'Choose a Site Icon' ); ?>
 233              <?php endif; ?>
 234          </button>
 235          <button
 236              id="js-remove-site-icon"
 237              type="button"
 238              <?php echo has_site_icon() ? 'class="button button-secondary reset remove-site-icon"' : 'class="button button-secondary reset remove-site-icon hidden"'; ?>
 239          >
 240              <?php _e( 'Remove Site Icon' ); ?>
 241          </button>
 242      </div>
 243  
 244      <p class="description">
 245          <?php
 246              printf(
 247                  /* translators: 1: pixel value for icon size. 2: pixel value for icon size. */
 248                  __( 'The Site Icon is what you see in browser tabs, bookmark bars, and within the WordPress mobile apps. It should be square and at least <strong>%1$s by %2$s</strong> pixels.' ),
 249                  512,
 250                  512
 251              );
 252          ?>
 253      </p>
 254  
 255  </td>
 256  </tr>
 257  
 258      <?php
 259  endif;
 260      /* End Site Icon */
 261  
 262  if ( ! is_multisite() ) {
 263      $wp_site_url_class = '';
 264      $wp_home_class     = '';
 265      if ( defined( 'WP_SITEURL' ) ) {
 266          $wp_site_url_class = ' disabled';
 267      }
 268      if ( defined( 'WP_HOME' ) ) {
 269          $wp_home_class = ' disabled';
 270      }
 271      ?>
 272  
 273  <tr>
 274  <th scope="row"><label for="siteurl"><?php _e( 'WordPress Address (URL)' ); ?></label></th>
 275  <td><input name="siteurl" type="url" id="siteurl" value="<?php form_option( 'siteurl' ); ?>"<?php disabled( defined( 'WP_SITEURL' ) ); ?> class="regular-text code<?php echo $wp_site_url_class; ?>" /></td>
 276  </tr>
 277  
 278  <tr>
 279  <th scope="row"><label for="home"><?php _e( 'Site Address (URL)' ); ?></label></th>
 280  <td><input name="home" type="url" id="home" aria-describedby="home-description" value="<?php form_option( 'home' ); ?>"<?php disabled( defined( 'WP_HOME' ) ); ?> class="regular-text code<?php echo $wp_home_class; ?>" />
 281      <?php if ( ! defined( 'WP_HOME' ) ) : ?>
 282  <p class="description" id="home-description">
 283          <?php
 284          printf(
 285              /* translators: %s: Documentation URL. */
 286              __( 'Enter the same address here unless you <a href="%s">want your site home page to be different from your WordPress installation directory</a>.' ),
 287              __( 'https://developer.wordpress.org/advanced-administration/server/wordpress-in-directory/' )
 288          );
 289          ?>
 290  </p>
 291  <?php endif; ?>
 292  </td>
 293  </tr>
 294  
 295  <?php } ?>
 296  
 297  <tr>
 298  <th scope="row"><label for="new_admin_email"><?php _e( 'Administration Email Address' ); ?></label></th>
 299  <td><input name="new_admin_email" type="email" id="new_admin_email" aria-describedby="new-admin-email-description" value="<?php form_option( 'admin_email' ); ?>" class="regular-text ltr" />
 300  <p class="description" id="new-admin-email-description"><?php _e( 'This address is used for admin purposes. If you change this, an email will be sent to your new address to confirm it. <strong>The new address will not become active until confirmed.</strong>' ); ?></p>
 301  <?php
 302  if ( $pending_new_admin_email ) {
 303      $pending_admin_email_message = sprintf(
 304          /* translators: %s: New administration email address. */
 305          __( 'There is a pending change of the administration email to %s.' ),
 306          '<code>' . esc_html( $new_admin_email ) . '</code>'
 307      );
 308      $pending_admin_email_message .= $pending_admin_email_cancel_request_link;
 309      wp_admin_notice(
 310          $pending_admin_email_message,
 311          array(
 312              'type'               => 'info',
 313              'additional_classes' => array( 'inline' ),
 314          )
 315      );
 316  }
 317  ?>
 318  </td>
 319  </tr>
 320  
 321  <?php
 322  if ( ! is_multisite() ) {
 323      $membership_title = __( 'Membership' );
 324      ?>
 325  <tr>
 326  <th scope="row"><?php echo $membership_title; ?></th>
 327  <td><fieldset><legend class="screen-reader-text"><span><?php echo $membership_title; ?></span></legend><label for="users_can_register">
 328  <input name="users_can_register" type="checkbox" id="users_can_register" value="1" <?php checked( '1', get_option( 'users_can_register' ) ); ?> />
 329      <?php _e( 'Anyone can register' ); ?></label>
 330  </fieldset></td>
 331  </tr>
 332  
 333  <tr>
 334  <th scope="row"><label for="default_role"><?php _e( 'New User Default Role' ); ?></label></th>
 335  <td>
 336      <?php
 337      /**
 338       * Filters the roles to be excluded from the default_role option.
 339       *
 340       * @since 7.0.0
 341       *
 342       * @param string[] $roles_to_exclude Array of roles to exclude from the dropdown.
 343       *                                   Defaults to administrator and editor.
 344       */
 345      $excluded_roles = (array) apply_filters( 'default_role_dropdown_excluded_roles', array( 'administrator', 'editor' ) );
 346  
 347      $editable_roles = array_reverse( get_editable_roles() );
 348  
 349      $selected = get_option( 'default_role' );
 350  
 351      foreach ( $editable_roles as $role => $details ) {
 352          if ( in_array( $role, $excluded_roles, true ) && $role !== $selected ) {
 353              unset( $editable_roles[ $role ] );
 354          }
 355      }
 356      ?>
 357      <select name="default_role" id="default_role"><?php wp_dropdown_roles( $selected, $editable_roles ); ?></select>
 358  </td>
 359  </tr>
 360  
 361      <?php
 362  }
 363  
 364  $languages    = get_available_languages();
 365  $translations = wp_get_available_translations();
 366  if ( ! is_multisite() && defined( 'WPLANG' ) && '' !== WPLANG && 'en_US' !== WPLANG && ! in_array( WPLANG, $languages, true ) ) {
 367      $languages[] = WPLANG;
 368  }
 369  if ( ! empty( $languages ) || ! empty( $translations ) ) {
 370      ?>
 371      <tr>
 372          <th scope="row"><label for="WPLANG"><?php _e( 'Site Language' ); ?><span class="dashicons dashicons-translation" aria-hidden="true"></span></label></th>
 373          <td>
 374              <?php
 375              $locale = get_locale();
 376              if ( ! in_array( $locale, $languages, true ) ) {
 377                  $locale = '';
 378              }
 379  
 380              wp_dropdown_languages(
 381                  array(
 382                      'name'                        => 'WPLANG',
 383                      'id'                          => 'WPLANG',
 384                      'selected'                    => $locale,
 385                      'languages'                   => $languages,
 386                      'translations'                => $translations,
 387                      'show_available_translations' => current_user_can( 'install_languages' ) && wp_can_install_language_pack(),
 388                  )
 389              );
 390  
 391              // Add note about deprecated WPLANG constant.
 392              if ( defined( 'WPLANG' ) && ( '' !== WPLANG ) && WPLANG !== $locale ) {
 393                  _deprecated_argument(
 394                      'define()',
 395                      '4.0.0',
 396                      /* translators: 1: WPLANG, 2: wp-config.php */
 397                      sprintf( __( 'The %1$s constant in your %2$s file is no longer needed.' ), 'WPLANG', 'wp-config.php' )
 398                  );
 399              }
 400              ?>
 401          </td>
 402      </tr>
 403      <?php
 404  }
 405  ?>
 406  <tr>
 407  <?php
 408  $current_offset = get_option( 'gmt_offset' );
 409  $tzstring       = get_option( 'timezone_string' );
 410  
 411  $check_zone_info = true;
 412  
 413  // Remove old Etc mappings. Fallback to gmt_offset.
 414  if ( str_contains( $tzstring, 'Etc/GMT' ) ) {
 415      $tzstring = '';
 416  }
 417  
 418  if ( empty( $tzstring ) ) { // Create a UTC+- zone if no timezone string exists.
 419      $check_zone_info = false;
 420      if ( 0 === (int) $current_offset ) {
 421          $tzstring = 'UTC+0';
 422      } elseif ( $current_offset < 0 ) {
 423          $tzstring = 'UTC' . $current_offset;
 424      } else {
 425          $tzstring = 'UTC+' . $current_offset;
 426      }
 427  }
 428  
 429  ?>
 430  <th scope="row"><label for="timezone_string"><?php _e( 'Timezone' ); ?></label></th>
 431  <td>
 432  
 433  <select id="timezone_string" name="timezone_string" aria-describedby="timezone-description">
 434      <?php echo wp_timezone_choice( $tzstring, get_user_locale() ); ?>
 435  </select>
 436  
 437  <p class="description" id="timezone-description">
 438  <?php
 439      printf(
 440          /* translators: %s: UTC abbreviation */
 441          __( 'Choose either a city in the same timezone as you or a %s (Coordinated Universal Time) time offset.' ),
 442          '<abbr>UTC</abbr>'
 443      );
 444      ?>
 445  </p>
 446  
 447  <p class="timezone-info">
 448      <span id="utc-time">
 449      <?php
 450          printf(
 451              /* translators: %s: UTC time. */
 452              __( 'Universal time is %s.' ),
 453              '<code>' . date_i18n( $timezone_format, false, true ) . '</code>'
 454          );
 455          ?>
 456      </span>
 457  <?php if ( get_option( 'timezone_string' ) || ! empty( $current_offset ) ) : ?>
 458      <span id="local-time">
 459      <?php
 460          printf(
 461              /* translators: %s: Local time. */
 462              __( 'Local time is %s.' ),
 463              '<code>' . date_i18n( $timezone_format ) . '</code>'
 464          );
 465      ?>
 466      </span>
 467  <?php endif; ?>
 468  </p>
 469  
 470  <?php if ( $check_zone_info && $tzstring ) : ?>
 471  <p class="timezone-info">
 472  <span>
 473      <?php
 474      $now = new DateTime( 'now', new DateTimeZone( $tzstring ) );
 475      $dst = (bool) $now->format( 'I' );
 476  
 477      if ( $dst ) {
 478          _e( 'This timezone is currently in daylight saving time.' );
 479      } else {
 480          _e( 'This timezone is currently in standard time.' );
 481      }
 482      ?>
 483      <br />
 484      <?php
 485      if ( in_array( $tzstring, timezone_identifiers_list( DateTimeZone::ALL_WITH_BC ), true ) ) {
 486          $transitions = timezone_transitions_get( timezone_open( $tzstring ), time() );
 487  
 488          // 0 index is the state at current time, 1 index is the next transition, if any.
 489          if ( ! empty( $transitions[1] ) ) {
 490              echo ' ';
 491              $message = $transitions[1]['isdst'] ?
 492                  /* translators: %s: Date and time. */
 493                  __( 'Daylight saving time begins on: %s.' ) :
 494                  /* translators: %s: Date and time. */
 495                  __( 'Standard time begins on: %s.' );
 496              printf(
 497                  $message,
 498                  /* translators: Localized date and time format, see https://www.php.net/manual/datetime.format.php */
 499                  '<code>' . wp_date( __( 'F j, Y g:i a' ), $transitions[1]['ts'] ) . '</code>'
 500              );
 501          } else {
 502              _e( 'This timezone does not observe daylight saving time.' );
 503          }
 504      }
 505      ?>
 506      </span>
 507  </p>
 508  <?php endif; ?>
 509  </td>
 510  </tr>
 511  
 512  <?php $date_format_title = __( 'Date Format' ); ?>
 513  <tr>
 514  <th scope="row"><?php echo $date_format_title; ?></th>
 515  <td>
 516      <fieldset><legend class="screen-reader-text"><span><?php echo $date_format_title; ?></span></legend>
 517  <?php
 518      /**
 519       * Filters the default date formats.
 520       *
 521       * @since 2.7.0
 522       * @since 4.0.0 Replaced the `Y/m/d` format with `Y-m-d` (ISO date standard YYYY-MM-DD).
 523       * @since 6.8.0 Added the `d.m.Y` format.
 524       *
 525       * @param string[] $default_date_formats Array of default date formats.
 526       */
 527      $date_formats = array_unique( apply_filters( 'date_formats', array( __( 'F j, Y' ), 'Y-m-d', 'm/d/Y', 'd/m/Y', 'd.m.Y' ) ) );
 528  
 529      $custom = true;
 530  
 531  foreach ( $date_formats as $format ) {
 532      echo "\t<label><input type='radio' name='date_format' value='" . esc_attr( $format ) . "'";
 533      if ( get_option( 'date_format' ) === $format ) { // checked() uses "==" rather than "===".
 534          echo " checked='checked'";
 535          $custom = false;
 536      }
 537      echo ' /> <span class="date-time-text format-i18n">' . date_i18n( $format ) . '</span><code>' . esc_html( $format ) . "</code></label><br />\n";
 538  }
 539  
 540      echo '<label><input type="radio" name="date_format" id="date_format_custom_radio" value="\c\u\s\t\o\m"';
 541      checked( $custom );
 542      echo '/> <span class="date-time-text date-time-custom-text">' . __( 'Custom:' ) . '<span class="screen-reader-text"> ' .
 543              /* translators: Hidden accessibility text. */
 544              __( 'enter a custom date format in the following field' ) .
 545          '</span></span></label>' .
 546          '<label for="date_format_custom" class="screen-reader-text">' .
 547              /* translators: Hidden accessibility text. */
 548              __( 'Custom date format:' ) .
 549          '</label>' .
 550          '<input type="text" name="date_format_custom" id="date_format_custom" value="' . esc_attr( get_option( 'date_format' ) ) . '" class="small-text" />' .
 551          '<br />' .
 552          '<p><strong>' . __( 'Preview:' ) . '</strong> <span class="example">' . date_i18n( get_option( 'date_format' ) ) . '</span>' .
 553          "<span class='spinner'></span>\n" . '</p>';
 554  ?>
 555      </fieldset>
 556  </td>
 557  </tr>
 558  
 559  <?php $time_format_title = __( 'Time Format' ); ?>
 560  <tr>
 561  <th scope="row"><?php echo $time_format_title; ?></th>
 562  <td>
 563      <fieldset><legend class="screen-reader-text"><span><?php echo $time_format_title; ?></span></legend>
 564  <?php
 565      /**
 566       * Filters the default time formats.
 567       *
 568       * @since 2.7.0
 569       *
 570       * @param string[] $default_time_formats Array of default time formats.
 571       */
 572      $time_formats = array_unique( apply_filters( 'time_formats', array( __( 'g:i a' ), 'g:i A', 'H:i' ) ) );
 573  
 574      $custom = true;
 575  
 576  foreach ( $time_formats as $format ) {
 577      echo "\t<label><input type='radio' name='time_format' value='" . esc_attr( $format ) . "'";
 578      if ( get_option( 'time_format' ) === $format ) { // checked() uses "==" rather than "===".
 579          echo " checked='checked'";
 580          $custom = false;
 581      }
 582      echo ' /> <span class="date-time-text format-i18n">' . date_i18n( $format ) . '</span><code>' . esc_html( $format ) . "</code></label><br />\n";
 583  }
 584  
 585      echo '<label><input type="radio" name="time_format" id="time_format_custom_radio" value="\c\u\s\t\o\m"';
 586      checked( $custom );
 587      echo '/> <span class="date-time-text date-time-custom-text">' . __( 'Custom:' ) . '<span class="screen-reader-text"> ' .
 588              /* translators: Hidden accessibility text. */
 589              __( 'enter a custom time format in the following field' ) .
 590          '</span></span></label>' .
 591          '<label for="time_format_custom" class="screen-reader-text">' .
 592              /* translators: Hidden accessibility text. */
 593              __( 'Custom time format:' ) .
 594          '</label>' .
 595          '<input type="text" name="time_format_custom" id="time_format_custom" value="' . esc_attr( get_option( 'time_format' ) ) . '" class="small-text" />' .
 596          '<br />' .
 597          '<p><strong>' . __( 'Preview:' ) . '</strong> <span class="example">' . date_i18n( get_option( 'time_format' ) ) . '</span>' .
 598          "<span class='spinner'></span>\n" . '</p>';
 599  
 600      echo "\t<p class='date-time-doc'>" . __( '<a href="https://wordpress.org/documentation/article/customize-date-and-time-format/">Documentation on date and time formatting</a>.' ) . "</p>\n";
 601  ?>
 602      </fieldset>
 603  </td>
 604  </tr>
 605  <tr>
 606  <th scope="row"><label for="start_of_week"><?php _e( 'Week Starts On' ); ?></label></th>
 607  <td><select name="start_of_week" id="start_of_week">
 608  <?php
 609  /**
 610   * @global WP_Locale $wp_locale WordPress date and time locale object.
 611   */
 612  global $wp_locale;
 613  
 614  for ( $day_index = 0; $day_index <= 6; $day_index++ ) :
 615      $selected = ( (int) get_option( 'start_of_week' ) === $day_index ) ? 'selected="selected"' : '';
 616      echo "\n\t<option value='" . esc_attr( $day_index ) . "' $selected>" . $wp_locale->get_weekday( $day_index ) . '</option>';
 617  endfor;
 618  ?>
 619  </select></td>
 620  </tr>
 621  <?php do_settings_fields( 'general', 'default' ); ?>
 622  </table>
 623  
 624  <?php do_settings_sections( 'general' ); ?>
 625  
 626  <?php submit_button(); ?>
 627  </form>
 628  
 629  </div>
 630  
 631  <?php require_once  ABSPATH . 'wp-admin/admin-footer.php'; ?>


Generated : Mon Oct 12 08:20:33 2026 Cross-referenced by PHPXref