register_initial_settings

Register default settings available in WordPress.

Description

register_initial_settings(); 

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


Usage

  1. if ( !function_exists( 'register_initial_settings' ) ) { 
  2. require_once ABSPATH . WPINC . '/option.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = register_initial_settings(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/option.php  
  1. function register_initial_settings() { 
  2. register_setting( 'general', 'blogname', array( 
  3. 'show_in_rest' => array( 
  4. 'name' => 'title',  
  5. ),  
  6. 'type' => 'string',  
  7. 'description' => __( 'Site title.' ),  
  8. ) ); 
  9.  
  10. register_setting( 'general', 'blogdescription', array( 
  11. 'show_in_rest' => array( 
  12. 'name' => 'description',  
  13. ),  
  14. 'type' => 'string',  
  15. 'description' => __( 'Site tagline.' ),  
  16. ) ); 
  17.  
  18. if ( ! is_multisite() ) { 
  19. register_setting( 'general', 'siteurl', array( 
  20. 'show_in_rest' => array( 
  21. 'name' => 'url',  
  22. 'schema' => array( 
  23. 'format' => 'uri',  
  24. ),  
  25. ),  
  26. 'type' => 'string',  
  27. 'description' => __( 'Site URL.' ),  
  28. ) ); 
  29.  
  30. if ( ! is_multisite() ) { 
  31. register_setting( 'general', 'admin_email', array( 
  32. 'show_in_rest' => array( 
  33. 'name' => 'email',  
  34. 'schema' => array( 
  35. 'format' => 'email',  
  36. ),  
  37. ),  
  38. 'type' => 'string',  
  39. 'description' => __( 'This address is used for admin purposes, like new user notification.' ),  
  40. ) ); 
  41.  
  42. register_setting( 'general', 'timezone_string', array( 
  43. 'show_in_rest' => array( 
  44. 'name' => 'timezone',  
  45. ),  
  46. 'type' => 'string',  
  47. 'description' => __( 'A city in the same timezone as you.' ),  
  48. ) ); 
  49.  
  50. register_setting( 'general', 'date_format', array( 
  51. 'show_in_rest' => true,  
  52. 'type' => 'string',  
  53. 'description' => __( 'A date format for all date strings.' ),  
  54. ) ); 
  55.  
  56. register_setting( 'general', 'time_format', array( 
  57. 'show_in_rest' => true,  
  58. 'type' => 'string',  
  59. 'description' => __( 'A time format for all time strings.' ),  
  60. ) ); 
  61.  
  62. register_setting( 'general', 'start_of_week', array( 
  63. 'show_in_rest' => true,  
  64. 'type' => 'integer',  
  65. 'description' => __( 'A day number of the week that the week should start on.' ),  
  66. ) ); 
  67.  
  68. register_setting( 'general', 'WPLANG', array( 
  69. 'show_in_rest' => array( 
  70. 'name' => 'language',  
  71. ),  
  72. 'type' => 'string',  
  73. 'description' => __( 'WordPress locale code.' ),  
  74. 'default' => 'en_US',  
  75. ) ); 
  76.  
  77. register_setting( 'writing', 'use_smilies', array( 
  78. 'show_in_rest' => true,  
  79. 'type' => 'boolean',  
  80. 'description' => __( 'Convert emoticons like :-) and :-P to graphics on display.' ),  
  81. 'default' => true,  
  82. ) ); 
  83.  
  84. register_setting( 'writing', 'default_category', array( 
  85. 'show_in_rest' => true,  
  86. 'type' => 'integer',  
  87. 'description' => __( 'Default post category.' ),  
  88. ) ); 
  89.  
  90. register_setting( 'writing', 'default_post_format', array( 
  91. 'show_in_rest' => true,  
  92. 'type' => 'string',  
  93. 'description' => __( 'Default post format.' ),  
  94. ) ); 
  95.  
  96. register_setting( 'reading', 'posts_per_page', array( 
  97. 'show_in_rest' => true,  
  98. 'type' => 'integer',  
  99. 'description' => __( 'Blog pages show at most.' ),  
  100. 'default' => 10,  
  101. ) ); 
  102.  
  103. register_setting( 'discussion', 'default_ping_status', array( 
  104. 'show_in_rest' => array( 
  105. 'schema' => array( 
  106. 'enum' => array( 'open', 'closed' ),  
  107. ),  
  108. ),  
  109. 'type' => 'string',  
  110. 'description' => __( 'Allow link notifications from other blogs (pingbacks and trackbacks) on new articles.' ),  
  111. ) ); 
  112.  
  113. register_setting( 'discussion', 'default_comment_status', array( 
  114. 'show_in_rest' => array( 
  115. 'schema' => array( 
  116. 'enum' => array( 'open', 'closed' ),  
  117. ),  
  118. ),  
  119. 'type' => 'string',  
  120. 'description' => __( 'Allow people to post comments on new articles.' ),  
  121. ) ); 
  122.