populate_options() – Create WordPress options and set the default values.

You appear to be a bot. Output may be restricted

Description

Create WordPress options and set the default values.

Usage

populate_options( $options );

Parameters

$options
( array ) optional – Optional. Custom option $key => $value pairs to use. Default empty array.

Returns

void

Source

File name: wordpress/wp-admin/includes/schema.php
Lines:

1 to 100 of 338
function populate_options( array $options = array() ) {
  global $wpdb, $wp_db_version, $wp_current_db_version;

  $guessurl = wp_guess_url();
  
/**
 * Fires before creating WordPress options and populating their default values.
 *
 * @since 2.6.0
 */
  do_action( 'populate_options' );

  // If WP_DEFAULT_THEME doesn't exist, fall back to the latest core default theme.
  $stylesheet = WP_DEFAULT_THEME;
  $template   = WP_DEFAULT_THEME;
  $theme      = wp_get_theme( WP_DEFAULT_THEME );
  if ( ! $theme->exists() ) {
    $theme = WP_Theme::WP_Theme::get_core_default_theme();
  }

  // If we can't find a core default theme, WP_DEFAULT_THEME is the best we can do.
  if ( $theme ) {
    $stylesheet = $theme->get_stylesheet();
    $template   = $theme->get_template();
  }

  $timezone_string = '';
  $gmt_offset      = 0;
  /*
	 * translators: default GMT offset or timezone string. Must be either a valid offset (-12 to 14)
	 * or a valid timezone string (America/New_York). See https://www.php.net/manual/en/timezones.php
	 * for all timezone strings supported by PHP.
	 */
  $offset_or_tz = _x( '0', 'default GMT offset or timezone string' );
  if ( is_numeric( $offset_or_tz ) ) {
    $gmt_offset = $offset_or_tz;
  } elseif ( $offset_or_tz && in_array( $offset_or_tz, timezone_identifiers_list(), true ) ) {
      $timezone_string = $offset_or_tz;
  }

  $defaults = array(
    'siteurl'                         => $guessurl,
    'home'                            => $guessurl,
    'blogname'                        => __( 'My Site' ),
    /* translators: Site tagline. */
    'blogdescription'                 => __( 'Just another WordPress site' ),
    'users_can_register'              => 0,
    'admin_email'                     => 'you@example.com',
    /* translators: Default start of the week. 0 = Sunday, 1 = Monday. */
    'start_of_week'                   => _x( '1', 'start of week' ),
    'use_balanceTags'                 => 0,
    'use_smilies'                     => 1,
    'require_name_email'              => 1,
    'comments_notify'                 => 1,
    'posts_per_rss'                   => 10,
    'rss_use_excerpt'                 => 0,
    'mailserver_url'                  => 'mail.example.com',
    'mailserver_login'                => 'login@example.com',
    'mailserver_pass'                 => 'password',
    'mailserver_port'                 => 110,
    'default_category'                => 1,
    'default_comment_status'          => 'open',
    'default_ping_status'             => 'open',
    'default_pingback_flag'           => 1,
    'posts_per_page'                  => 10,
    /* translators: Default date format, see https://www.php.net/manual/datetime.format.php */
    'date_format'                     => __( 'F j, Y' ),
    /* translators: Default time format, see https://www.php.net/manual/datetime.format.php */
    'time_format'                     => __( 'g:i a' ),
    /* translators: Links last updated date format, see https://www.php.net/manual/datetime.format.php */
    'links_updated_date_format'       => __( 'F j, Y g:i a' ),
    'comment_moderation'              => 0,
    'moderation_notify'               => 1,
    'permalink_structure'             => '',
    'rewrite_rules'                   => '',
    'hack_file'                       => 0,
    'blog_charset'                    => 'UTF-8',
    'moderation_keys'                 => '',
    'active_plugins'                  => array(),
    'category_base'                   => '',
    'ping_sites'                      => 'http://rpc.pingomatic.com/',
    'comment_max_links'               => 2,
    'gmt_offset'                      => $gmt_offset,

    // 1.5.0
    'default_email_category'          => 1,
    'recently_edited'                 => '',
    'template'                        => $template,
    'stylesheet'                      => $stylesheet,
    'comment_registration'            => 0,
    'html_type'                       => 'text/html',

    // 1.5.1
    'use_trackback'                   => 0,

    // 2.0.0
    'default_role'                    => 'subscriber',
    'db_version'                      => $wp_db_version,

    // 2.0.1
    'uploads_use_yearmonth_folders'   => 1,
 

 View on GitHub View on Trac