A WordPress-centric search engine for devs and theme authors



register_initial_settings ›

Since4.7.0
Deprecatedn/a
register_initial_settings ( No parameters )
Defined at:
Codex:

Register default settings available in WordPress.

The settings registered here are primarily useful for the REST API, so this does not encompass all settings available in WordPress.



Source

function register_initial_settings() {
	register_setting( 'general', 'blogname', array(
		'show_in_rest' => array(
			'name' => 'title',
		),
		'type'         => 'string',
		'description'  => __( 'Site title.' ),
	) );

	register_setting( 'general', 'blogdescription', array(
		'show_in_rest' => array(
			'name' => 'description',
		),
		'type'         => 'string',
		'description'  => __( 'Site tagline.' ),
	) );

	if ( ! is_multisite() ) {
		register_setting( 'general', 'siteurl', array(
			'show_in_rest' => array(
				'name'    => 'url',
				'schema'  => array(
					'format' => 'uri',
				),
			),
			'type'         => 'string',
			'description'  => __( 'Site URL.' ),
		) );
	}

	if ( ! is_multisite() ) {
		register_setting( 'general', 'admin_email', array(
			'show_in_rest' => array(
				'name'    => 'email',
				'schema'  => array(
					'format' => 'email',
				),
			),
			'type'         => 'string',
			'description'  => __( 'This address is used for admin purposes, like new user notification.' ),
		) );
	}

	register_setting( 'general', 'timezone_string', array(
		'show_in_rest' => array(
			'name' => 'timezone',
		),
		'type'         => 'string',
		'description'  => __( 'A city in the same timezone as you.' ),
	) );

	register_setting( 'general', 'date_format', array(
		'show_in_rest' => true,
		'type'         => 'string',
		'description'  => __( 'A date format for all date strings.' ),
	) );

	register_setting( 'general', 'time_format', array(
		'show_in_rest' => true,
		'type'         => 'string',
		'description'  => __( 'A time format for all time strings.' ),
	) );

	register_setting( 'general', 'start_of_week', array(
		'show_in_rest' => true,
		'type'         => 'integer',
		'description'  => __( 'A day number of the week that the week should start on.' ),
	) );

	register_setting( 'general', 'WPLANG', array(
		'show_in_rest' => array(
			'name' => 'language',
		),
		'type'         => 'string',
		'description'  => __( 'WordPress locale code.' ),
		'default'      => 'en_US',
	) );

	register_setting( 'writing', 'use_smilies', array(
		'show_in_rest' => true,
		'type'         => 'boolean',
		'description'  => __( 'Convert emoticons like :-) and :-P to graphics on display.' ),
		'default'      => true,
	) );

	register_setting( 'writing', 'default_category', array(
		'show_in_rest' => true,
		'type'         => 'integer',
		'description'  => __( 'Default post category.' ),
	) );

	register_setting( 'writing', 'default_post_format', array(
		'show_in_rest' => true,
		'type'         => 'string',
		'description'  => __( 'Default post format.' ),
	) );

	register_setting( 'reading', 'posts_per_page', array(
		'show_in_rest' => true,
		'type'         => 'integer',
		'description'  => __( 'Blog pages show at most.' ),
		'default'      => 10,
	) );

	register_setting( 'discussion', 'default_ping_status', array(
		'show_in_rest' => array(
			'schema'   => array(
				'enum' => array( 'open', 'closed' ),
			),
		),
		'type'         => 'string',
		'description'  => __( 'Allow link notifications from other blogs (pingbacks and trackbacks) on new articles.' ),
	) );

	register_setting( 'discussion', 'default_comment_status', array(
		'show_in_rest' => array(
			'schema'   => array(
				'enum' => array( 'open', 'closed' ),
			),
		),
		'type'         => 'string',
		'description'  => __( 'Allow people to post comments on new articles.' ),
	) );

}