Skip to content

Commit b9a0d81

Browse files
Add show in abilities to core settings
1 parent ea80213 commit b9a0d81

1 file changed

Lines changed: 94 additions & 73 deletions

File tree

src/wp-includes/option.php

Lines changed: 94 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -2743,25 +2743,27 @@ function register_initial_settings() {
27432743
'general',
27442744
'blogname',
27452745
array(
2746-
'show_in_rest' => array(
2746+
'show_in_rest' => array(
27472747
'name' => 'title',
27482748
),
2749-
'type' => 'string',
2750-
'label' => __( 'Title' ),
2751-
'description' => __( 'Site title.' ),
2749+
'show_in_abilities' => true,
2750+
'type' => 'string',
2751+
'label' => __( 'Title' ),
2752+
'description' => __( 'Site title.' ),
27522753
)
27532754
);
27542755

27552756
register_setting(
27562757
'general',
27572758
'blogdescription',
27582759
array(
2759-
'show_in_rest' => array(
2760+
'show_in_rest' => array(
27602761
'name' => 'description',
27612762
),
2762-
'type' => 'string',
2763-
'label' => __( 'Tagline' ),
2764-
'description' => __( 'Site tagline.' ),
2763+
'show_in_abilities' => true,
2764+
'type' => 'string',
2765+
'label' => __( 'Tagline' ),
2766+
'description' => __( 'Site tagline.' ),
27652767
)
27662768
);
27672769

@@ -2770,14 +2772,15 @@ function register_initial_settings() {
27702772
'general',
27712773
'siteurl',
27722774
array(
2773-
'show_in_rest' => array(
2775+
'show_in_rest' => array(
27742776
'name' => 'url',
27752777
'schema' => array(
27762778
'format' => 'uri',
27772779
),
27782780
),
2779-
'type' => 'string',
2780-
'description' => __( 'Site URL.' ),
2781+
'show_in_abilities' => true,
2782+
'type' => 'string',
2783+
'description' => __( 'Site URL.' ),
27812784
)
27822785
);
27832786
}
@@ -2787,14 +2790,15 @@ function register_initial_settings() {
27872790
'general',
27882791
'admin_email',
27892792
array(
2790-
'show_in_rest' => array(
2793+
'show_in_rest' => array(
27912794
'name' => 'email',
27922795
'schema' => array(
27932796
'format' => 'email',
27942797
),
27952798
),
2796-
'type' => 'string',
2797-
'description' => __( 'This address is used for admin purposes, like new user notification.' ),
2799+
'show_in_abilities' => true,
2800+
'type' => 'string',
2801+
'description' => __( 'This address is used for admin purposes, like new user notification.' ),
27982802
)
27992803
);
28002804
}
@@ -2803,158 +2807,172 @@ function register_initial_settings() {
28032807
'general',
28042808
'timezone_string',
28052809
array(
2806-
'show_in_rest' => array(
2810+
'show_in_rest' => array(
28072811
'name' => 'timezone',
28082812
),
2809-
'type' => 'string',
2810-
'description' => __( 'A city in the same timezone as you.' ),
2813+
'show_in_abilities' => true,
2814+
'type' => 'string',
2815+
'description' => __( 'A city in the same timezone as you.' ),
28112816
)
28122817
);
28132818

28142819
register_setting(
28152820
'general',
28162821
'date_format',
28172822
array(
2818-
'show_in_rest' => true,
2819-
'type' => 'string',
2820-
'description' => __( 'A date format for all date strings.' ),
2823+
'show_in_rest' => true,
2824+
'show_in_abilities' => true,
2825+
'type' => 'string',
2826+
'description' => __( 'A date format for all date strings.' ),
28212827
)
28222828
);
28232829

28242830
register_setting(
28252831
'general',
28262832
'time_format',
28272833
array(
2828-
'show_in_rest' => true,
2829-
'type' => 'string',
2830-
'description' => __( 'A time format for all time strings.' ),
2834+
'show_in_rest' => true,
2835+
'show_in_abilities' => true,
2836+
'type' => 'string',
2837+
'description' => __( 'A time format for all time strings.' ),
28312838
)
28322839
);
28332840

28342841
register_setting(
28352842
'general',
28362843
'start_of_week',
28372844
array(
2838-
'show_in_rest' => true,
2839-
'type' => 'integer',
2840-
'description' => __( 'A day number of the week that the week should start on.' ),
2845+
'show_in_rest' => true,
2846+
'show_in_abilities' => true,
2847+
'type' => 'integer',
2848+
'description' => __( 'A day number of the week that the week should start on.' ),
28412849
)
28422850
);
28432851

28442852
register_setting(
28452853
'general',
28462854
'WPLANG',
28472855
array(
2848-
'show_in_rest' => array(
2856+
'show_in_rest' => array(
28492857
'name' => 'language',
28502858
),
2851-
'type' => 'string',
2852-
'description' => __( 'WordPress locale code.' ),
2853-
'default' => 'en_US',
2859+
'show_in_abilities' => true,
2860+
'type' => 'string',
2861+
'description' => __( 'WordPress locale code.' ),
2862+
'default' => 'en_US',
28542863
)
28552864
);
28562865

28572866
register_setting(
28582867
'writing',
28592868
'use_smilies',
28602869
array(
2861-
'show_in_rest' => true,
2862-
'type' => 'boolean',
2863-
'description' => __( 'Convert emoticons like :-) and :-P to graphics on display.' ),
2864-
'default' => true,
2870+
'show_in_rest' => true,
2871+
'show_in_abilities' => true,
2872+
'type' => 'boolean',
2873+
'description' => __( 'Convert emoticons like :-) and :-P to graphics on display.' ),
2874+
'default' => true,
28652875
)
28662876
);
28672877

28682878
register_setting(
28692879
'writing',
28702880
'default_category',
28712881
array(
2872-
'show_in_rest' => true,
2873-
'type' => 'integer',
2874-
'description' => __( 'Default post category.' ),
2882+
'show_in_rest' => true,
2883+
'show_in_abilities' => true,
2884+
'type' => 'integer',
2885+
'description' => __( 'Default post category.' ),
28752886
)
28762887
);
28772888

28782889
register_setting(
28792890
'writing',
28802891
'default_post_format',
28812892
array(
2882-
'show_in_rest' => true,
2883-
'type' => 'string',
2884-
'description' => __( 'Default post format.' ),
2893+
'show_in_rest' => true,
2894+
'show_in_abilities' => true,
2895+
'type' => 'string',
2896+
'description' => __( 'Default post format.' ),
28852897
)
28862898
);
28872899

28882900
register_setting(
28892901
'reading',
28902902
'posts_per_page',
28912903
array(
2892-
'show_in_rest' => true,
2893-
'type' => 'integer',
2894-
'label' => __( 'Maximum posts per page' ),
2895-
'description' => __( 'Blog pages show at most.' ),
2896-
'default' => 10,
2904+
'show_in_rest' => true,
2905+
'show_in_abilities' => true,
2906+
'type' => 'integer',
2907+
'label' => __( 'Maximum posts per page' ),
2908+
'description' => __( 'Blog pages show at most.' ),
2909+
'default' => 10,
28972910
)
28982911
);
28992912

29002913
register_setting(
29012914
'reading',
29022915
'show_on_front',
29032916
array(
2904-
'show_in_rest' => true,
2905-
'type' => 'string',
2906-
'label' => __( 'Show on front' ),
2907-
'description' => __( 'What to show on the front page' ),
2917+
'show_in_rest' => true,
2918+
'show_in_abilities' => true,
2919+
'type' => 'string',
2920+
'label' => __( 'Show on front' ),
2921+
'description' => __( 'What to show on the front page' ),
29082922
)
29092923
);
29102924

29112925
register_setting(
29122926
'reading',
29132927
'page_on_front',
29142928
array(
2915-
'show_in_rest' => true,
2916-
'type' => 'integer',
2917-
'label' => __( 'Page on front' ),
2918-
'description' => __( 'The ID of the page that should be displayed on the front page' ),
2929+
'show_in_rest' => true,
2930+
'show_in_abilities' => true,
2931+
'type' => 'integer',
2932+
'label' => __( 'Page on front' ),
2933+
'description' => __( 'The ID of the page that should be displayed on the front page' ),
29192934
)
29202935
);
29212936

29222937
register_setting(
29232938
'reading',
29242939
'page_for_posts',
29252940
array(
2926-
'show_in_rest' => true,
2927-
'type' => 'integer',
2928-
'description' => __( 'The ID of the page that should display the latest posts' ),
2941+
'show_in_rest' => true,
2942+
'show_in_abilities' => true,
2943+
'type' => 'integer',
2944+
'description' => __( 'The ID of the page that should display the latest posts' ),
29292945
)
29302946
);
29312947

29322948
register_setting(
29332949
'discussion',
29342950
'default_ping_status',
29352951
array(
2936-
'show_in_rest' => array(
2952+
'show_in_rest' => array(
29372953
'schema' => array(
29382954
'enum' => array( 'open', 'closed' ),
29392955
),
29402956
),
2941-
'type' => 'string',
2942-
'description' => __( 'Allow link notifications from other blogs (pingbacks and trackbacks) on new articles.' ),
2957+
'show_in_abilities' => true,
2958+
'type' => 'string',
2959+
'description' => __( 'Allow link notifications from other blogs (pingbacks and trackbacks) on new articles.' ),
29432960
)
29442961
);
29452962

29462963
register_setting(
29472964
'discussion',
29482965
'default_comment_status',
29492966
array(
2950-
'show_in_rest' => array(
2967+
'show_in_rest' => array(
29512968
'schema' => array(
29522969
'enum' => array( 'open', 'closed' ),
29532970
),
29542971
),
2955-
'type' => 'string',
2956-
'label' => __( 'Allow comments on new posts' ),
2957-
'description' => __( 'Allow people to submit comments on new posts.' ),
2972+
'show_in_abilities' => true,
2973+
'type' => 'string',
2974+
'label' => __( 'Allow comments on new posts' ),
2975+
'description' => __( 'Allow people to submit comments on new posts.' ),
29582976
)
29592977
);
29602978
}
@@ -2985,10 +3003,12 @@ function register_initial_settings() {
29853003
* @type string $label A label of the data attached to this setting.
29863004
* @type string $description A description of the data attached to this setting.
29873005
* @type callable $sanitize_callback A callback function that sanitizes the option's value.
2988-
* @type bool|array $show_in_rest Whether data associated with this setting should be included in the REST API.
2989-
* When registering complex settings, this argument may optionally be an
2990-
* array with a 'schema' key.
2991-
* @type mixed $default Default value when calling `get_option()`.
3006+
* @type bool|array $show_in_rest Whether data associated with this setting should be included in the REST API.
3007+
* When registering complex settings, this argument may optionally be an
3008+
* array with a 'schema' key.
3009+
* @type bool $show_in_abilities Whether this setting should be exposed through the Abilities API.
3010+
* Default false.
3011+
* @type mixed $default Default value when calling `get_option()`.
29923012
* }
29933013
*/
29943014
function register_setting( $option_group, $option_name, $args = array() ) {
@@ -3001,12 +3021,13 @@ function register_setting( $option_group, $option_name, $args = array() ) {
30013021
$GLOBALS['new_whitelist_options'] = &$new_allowed_options;
30023022

30033023
$defaults = array(
3004-
'type' => 'string',
3005-
'group' => $option_group,
3006-
'label' => '',
3007-
'description' => '',
3008-
'sanitize_callback' => null,
3009-
'show_in_rest' => false,
3024+
'type' => 'string',
3025+
'group' => $option_group,
3026+
'label' => '',
3027+
'description' => '',
3028+
'sanitize_callback' => null,
3029+
'show_in_rest' => false,
3030+
'show_in_abilities' => false,
30103031
);
30113032

30123033
// Back-compat: old sanitize callback is added.

0 commit comments

Comments
 (0)