Skip to content

Commit 24dde23

Browse files
committed
Docs: Declare the object shapes for some return values.
Props swissspidy See #63166 git-svn-id: https://develop.svn.wordpress.org/trunk@60236 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 8559f24 commit 24dde23

File tree

2 files changed

+39
-4
lines changed

2 files changed

+39
-4
lines changed

src/wp-includes/option.php

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3176,7 +3176,23 @@ function unregister_setting( $option_group, $option_name, $deprecated = '' ) {
31763176
*
31773177
* @global array $wp_registered_settings
31783178
*
3179-
* @return array List of registered settings, keyed by option name.
3179+
* @return array {
3180+
* List of registered settings, keyed by option name.
3181+
*
3182+
* @type array ...$0 {
3183+
* Data used to describe the setting when registered.
3184+
*
3185+
* @type string $type The type of data associated with this setting.
3186+
* Valid values are 'string', 'boolean', 'integer', 'number', 'array', and 'object'.
3187+
* @type string $label A label of the data attached to this setting.
3188+
* @type string $description A description of the data attached to this setting.
3189+
* @type callable $sanitize_callback A callback function that sanitizes the option's value.
3190+
* @type bool|array $show_in_rest Whether data associated with this setting should be included in the REST API.
3191+
* When registering complex settings, this argument may optionally be an
3192+
* array with a 'schema' key.
3193+
* @type mixed $default Default value when calling `get_option()`.
3194+
* }
3195+
* }
31803196
*/
31813197
function get_registered_settings() {
31823198
global $wp_registered_settings;

src/wp-includes/post.php

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1906,7 +1906,7 @@ function unregister_post_type( $post_type ) {
19061906
* Otherwise, an 's' will be added to the value for the plural form. After
19071907
* registration, capability_type will always be a string of the singular value.
19081908
*
1909-
* By default, eight keys are accepted as part of the capabilities array:
1909+
* By default, the following keys are accepted as part of the capabilities array:
19101910
*
19111911
* - edit_post, read_post, and delete_post are meta capabilities, which are then
19121912
* generally mapped to corresponding primitive capabilities depending on the
@@ -1921,8 +1921,9 @@ function unregister_post_type( $post_type ) {
19211921
* - delete_posts - Controls whether objects of this post type can be deleted.
19221922
* - publish_posts - Controls publishing objects of this post type.
19231923
* - read_private_posts - Controls whether private objects can be read.
1924+
* - create_posts - Controls whether objects of this post type can be created.
19241925
*
1925-
* These five primitive capabilities are checked in core in various locations.
1926+
* These primitive capabilities are checked in core in various locations.
19261927
* There are also six other primitive capabilities which are not referenced
19271928
* directly in core, except in map_meta_cap(), which takes the three aforementioned
19281929
* meta capabilities and translates them into one or more primitive capabilities
@@ -1948,7 +1949,25 @@ function unregister_post_type( $post_type ) {
19481949
* @see map_meta_cap()
19491950
*
19501951
* @param object $args Post type registration arguments.
1951-
* @return object Object with all the capabilities as member variables.
1952+
* @return object {
1953+
* Object with all the capabilities as member variables.
1954+
*
1955+
* @type string $edit_post Capability to edit a post.
1956+
* @type string $read_post Capability to read a post.
1957+
* @type string $delete_post Capability to delete a post.
1958+
* @type string $edit_posts Capability to edit posts.
1959+
* @type string $edit_others_posts Capability to edit others' posts.
1960+
* @type string $delete_posts Capability to delete posts.
1961+
* @type string $publish_posts Capability to publish posts.
1962+
* @type string $read_private_posts Capability to read private posts.
1963+
* @type string $create_posts Capability to create posts.
1964+
* @type string $read Optional. Capability to read a post.
1965+
* @type string $delete_private_posts Optional. Capability to delete private posts.
1966+
* @type string $delete_published_posts Optional. Capability to delete published posts.
1967+
* @type string $delete_others_posts Optional. Capability to delete others' posts.
1968+
* @type string $edit_private_posts Optional. Capability to edit private posts.
1969+
* @type string $edit_published_posts Optional. Capability to edit published posts.
1970+
* }
19521971
*/
19531972
function get_post_type_capabilities( $args ) {
19541973
if ( ! is_array( $args->capability_type ) ) {

0 commit comments

Comments
 (0)