Docs: Improve documentation for optional parameters per the documentation standards.

See #49572.
Built from https://develop.svn.wordpress.org/trunk@48197


git-svn-id: http://core.svn.wordpress.org/trunk@47966 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2020-06-28 11:49:02 +00:00
parent ee8e9905c4
commit 58ad216087
15 changed files with 84 additions and 76 deletions

View File

@ -61,7 +61,7 @@ function check_upload_size( $file ) {
* @global wpdb $wpdb WordPress database abstraction object.
*
* @param int $blog_id Site ID.
* @param bool $drop True if site's database tables should be dropped. Default is false.
* @param bool $drop True if site's database tables should be dropped. Default false.
*/
function wpmu_delete_blog( $blog_id, $drop = false ) {
global $wpdb;

View File

@ -16,7 +16,7 @@
* @param int|stdClass $bookmark
* @param string $output Optional. The required return type. One of OBJECT, ARRAY_A, or ARRAY_N, which correspond to
* an stdClass object, an associative array, or a numeric array, respectively. Default OBJECT.
* @param string $filter Optional, default is 'raw'.
* @param string $filter Optional. How to sanitize bookmark fields. Default 'raw'.
* @return array|object|null Type returned depends on $output value.
*/
function get_bookmark( $bookmark, $output = OBJECT, $filter = 'raw' ) {

View File

@ -71,7 +71,7 @@ function get_category_parents( $id, $link = false, $separator = '/', $nicename =
*
* @since 0.71
*
* @param int $id Optional, default to current post ID. The post ID.
* @param int $id Optional. The post ID. Defaults to current post ID.
* @return WP_Term[] Array of WP_Term objects, one for each category assigned to the post.
*/
function get_the_category( $id = false ) {

View File

@ -546,7 +546,7 @@ class WP_Customize_Setting {
*
* @since 3.4.0
*
* @param mixed $default A default value which is used as a fallback. Default is null.
* @param mixed $default A default value which is used as a fallback. Default null.
* @return mixed The default value on failure, otherwise the sanitized and validated value.
*/
final public function post_value( $default = null ) {
@ -848,7 +848,7 @@ class WP_Customize_Setting {
*
* @param $root
* @param $keys
* @param bool $create Default is false.
* @param bool $create Default false.
* @return array|void Keys are 'root', 'node', and 'key'.
*/
final protected function multidimensional( &$root, $keys, $create = false ) {
@ -929,7 +929,7 @@ class WP_Customize_Setting {
*
* @param $root
* @param $keys
* @param mixed $default A default value which is used as a fallback. Default is null.
* @param mixed $default A default value which is used as a fallback. Default null.
* @return mixed The requested value or the default value.
*/
final protected function multidimensional_get( $root, $keys, $default = null ) {

View File

@ -23,9 +23,10 @@ class WP_Http_Encoding {
*
* @since 2.8.0
*
* @param string $raw String to compress.
* @param int $level Optional, default is 9. Compression level, 9 is highest.
* @param string $supports Optional, not used. When implemented it will choose the right compression based on what the server supports.
* @param string $raw String to compress.
* @param int $level Optional. Compression level, 9 is highest. Default 9.
* @param string $supports Optional, not used. When implemented it will choose
* the right compression based on what the server supports.
* @return string|false False on failure.
*/
public static function compress( $raw, $level = 9, $supports = null ) {
@ -43,7 +44,7 @@ class WP_Http_Encoding {
* @since 2.8.0
*
* @param string $compressed String to decompress.
* @param int $length The optional length of the compressed data.
* @param int $length The optional length of the compressed data.
* @return string|bool False on failure.
*/
public static function decompress( $compressed, $length = null ) {

View File

@ -1228,7 +1228,8 @@ class WP_Rewrite {
* @see WP_Rewrite::generate_rewrite_rules() See for long description and rest of parameters.
*
* @param string $permalink_structure The permalink structure to generate rules.
* @param bool $walk_dirs Optional, default is false. Whether to create list of directories to walk over.
* @param bool $walk_dirs Optional. Whether to create list of directories to walk over.
* Default false.
* @return array
*/
public function generate_rewrite_rule( $permalink_structure, $walk_dirs = false ) {

View File

@ -201,8 +201,9 @@ class WP_Roles {
* @since 2.0.0
*
* @param string $role Role name.
* @param string $cap Capability name.
* @param bool $grant Optional, default is true. Whether role is capable of performing capability.
* @param string $cap Capability name.
* @param bool $grant Optional. Whether role is capable of performing capability.
* Default true.
*/
public function add_cap( $role, $cap, $grant = true ) {
if ( ! isset( $this->roles[ $role ] ) ) {
@ -221,7 +222,7 @@ class WP_Roles {
* @since 2.0.0
*
* @param string $role Role name.
* @param string $cap Capability name.
* @param string $cap Capability name.
*/
public function remove_cap( $role, $cap ) {
if ( ! isset( $this->roles[ $role ] ) ) {

View File

@ -1242,10 +1242,11 @@ function get_catname( $cat_ID ) {
* @deprecated 2.8.0 Use get_term_children()
* @see get_term_children()
*
* @param int $id Category ID to retrieve children.
* @param string $before Optional. Prepend before category term ID.
* @param string $after Optional, default is empty string. Append after category term ID.
* @param array $visited Optional. Category Term IDs that have already been added.
* @param int $id Category ID to retrieve children.
* @param string $before Optional. Prepend before category term ID. Default '/'.
* @param string $after Optional. Append after category term ID. Default empty string.
* @param array $visited Optional. Category Term IDs that have already been added.
* Default empty array.
* @return string
*/
function get_category_children( $id, $before = '/', $after = '', $visited = array() ) {
@ -1834,10 +1835,10 @@ function get_alloptions() {
* @deprecated 2.5.0 Use wp_get_attachment_link()
* @see wp_get_attachment_link()
*
* @param int $id Optional. Post ID.
* @param bool $fullsize Optional, default is false. Whether to use full size image.
* @param int $id Optional. Post ID.
* @param bool $fullsize Optional. Whether to use full size image. Default false.
* @param array $max_dims Optional. Max image dimensions.
* @param bool $permalink Optional, default is false. Whether to include permalink to image.
* @param bool $permalink Optional. Whether to include permalink to image. Default false.
* @return string
*/
function get_the_attachment_link($id = 0, $fullsize = false, $max_dims = false, $permalink = false) {
@ -1864,8 +1865,8 @@ function get_the_attachment_link($id = 0, $fullsize = false, $max_dims = false,
* @deprecated 2.5.0 Use wp_get_attachment_image_src()
* @see wp_get_attachment_image_src()
*
* @param int $id Optional. Post ID.
* @param bool $fullsize Optional, default to false. Whether to have full image.
* @param int $id Optional. Post ID.
* @param bool $fullsize Optional. Whether to have full image. Default false.
* @return array Icon URL and full path to file, respectively.
*/
function get_attachment_icon_src( $id = 0, $fullsize = false ) {
@ -1905,8 +1906,8 @@ function get_attachment_icon_src( $id = 0, $fullsize = false ) {
* @deprecated 2.5.0 Use wp_get_attachment_image()
* @see wp_get_attachment_image()
*
* @param int $id Optional. Post ID.
* @param bool $fullsize Optional, default to false. Whether to have full size image.
* @param int $id Optional. Post ID.
* @param bool $fullsize Optional. Whether to have full size image. Default false.
* @param array $max_dims Optional. Dimensions of image.
* @return string|false HTML content.
*/
@ -1961,8 +1962,8 @@ function get_attachment_icon( $id = 0, $fullsize = false, $max_dims = false ) {
* @deprecated 2.5.0 Use wp_get_attachment_image()
* @see wp_get_attachment_image()
*
* @param int $id Optional. Post ID.
* @param bool $fullsize Optional, default to false. Whether to have full size image.
* @param int $id Optional. Post ID.
* @param bool $fullsize Optional. Whether to have full size image. Default false.
* @param array $max_dims Optional. Dimensions of image.
* @return string|false
*/
@ -2386,7 +2387,7 @@ function get_users_of_blog( $id = '' ) {
* @deprecated 3.0.0 Use add_theme_support()
* @see add_theme_support()
*
* @param bool $add Optional, default is true. Add or remove links. Defaults to true.
* @param bool $add Optional. Add or remove links. Default true.
*/
function automatic_feed_links( $add = true ) {
_deprecated_function( __FUNCTION__, '3.0.0', "add_theme_support( 'automatic-feed-links' )" );
@ -2405,7 +2406,7 @@ function automatic_feed_links( $add = true ) {
* @see get_the_author_meta()
*
* @param string $field User meta field.
* @param false|int $user Optional. User ID to retrieve the field for. Default false (current user).
* @param false|int $user Optional. User ID to retrieve the field for. Default false (current user).
* @return string The author's field from the current author's DB object.
*/
function get_profile( $field, $user = false ) {
@ -2623,9 +2624,9 @@ function get_user_metavalues($ids) {
* @since 2.3.0
* @deprecated 3.3.0
*
* @param object|array $user The User Object or Array
* @param string $context Optional, default is 'display'. How to sanitize user fields.
* @return object|array The now sanitized User Object or Array (will be the same type as $user)
* @param object|array $user The user object or array.
* @param string $context Optional. How to sanitize user fields. Default 'display'.
* @return object|array The now sanitized user object or array (will be the same type as $user).
*/
function sanitize_user_object($user, $context = 'display') {
_deprecated_function( __FUNCTION__, '3.3.0' );
@ -2660,10 +2661,12 @@ function sanitize_user_object($user, $context = 'display') {
* @since 2.8.0
* @deprecated 3.3.0
*
* @param string $title Optional. Link title format.
* @param bool $in_same_cat Optional. Whether link should be in a same category.
* @param string $excluded_categories Optional. Excluded categories IDs.
* @param bool $start Optional, default is true. Whether to display link to first or last post.
* @param string $title Optional. Link title format. Default '%title'.
* @param bool $in_same_cat Optional. Whether link should be in a same category.
* Default false.
* @param string $excluded_categories Optional. Excluded categories IDs. Default empty.
* @param bool $start Optional. Whether to display link to first or last post.
* Default true.
* @return string
*/
function get_boundary_post_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '', $start = true) {
@ -3215,13 +3218,13 @@ function wp_load_image( $file ) {
* @deprecated 3.5.0 Use wp_get_image_editor()
* @see wp_get_image_editor()
*
* @param string $file Image file path.
* @param int $max_w Maximum width to resize to.
* @param int $max_h Maximum height to resize to.
* @param bool $crop Optional. Whether to crop image or resize.
* @param string $suffix Optional. File suffix.
* @param string $dest_path Optional. New image file path.
* @param int $jpeg_quality Optional, default is 90. Image quality percentage.
* @param string $file Image file path.
* @param int $max_w Maximum width to resize to.
* @param int $max_h Maximum height to resize to.
* @param bool $crop Optional. Whether to crop image or resize. Default false.
* @param string $suffix Optional. File suffix. Default null.
* @param string $dest_path Optional. New image file path. Default null.
* @param int $jpeg_quality Optional. Image quality percentage. Default 90.
* @return mixed WP_Error on failure. String with new destination path.
*/
function image_resize( $file, $max_w, $max_h, $crop = false, $suffix = null, $dest_path = null, $jpeg_quality = 90 ) {

View File

@ -1202,9 +1202,9 @@ function _wp_render_title_tag() {
*
* @global WP_Locale $wp_locale WordPress date and time locale object.
*
* @param string $sep Optional, default is '»'. How to separate the various items
* within the page title.
* @param bool $display Optional, default is true. Whether to display or retrieve title.
* @param string $sep Optional. How to separate the various items within the page title.
* Default '»'.
* @param bool $display Optional. Whether to display or retrieve title. Default true.
* @param string $seplocation Optional. Location of the separator ('left' or 'right').
* @return string|null String on retrieve, null when displaying.
*/
@ -1348,7 +1348,7 @@ function wp_title( $sep = '»', $display = true, $seplocation = '' ) {
* @since 0.71
*
* @param string $prefix Optional. What to display before the title.
* @param bool $display Optional, default is true. Whether to display or retrieve title.
* @param bool $display Optional. Whether to display or retrieve title. Default true.
* @return string|void Title when retrieving.
*/
function single_post_title( $prefix = '', $display = true ) {
@ -1383,7 +1383,7 @@ function single_post_title( $prefix = '', $display = true ) {
* @since 3.1.0
*
* @param string $prefix Optional. What to display before the title.
* @param bool $display Optional, default is true. Whether to display or retrieve title.
* @param bool $display Optional. Whether to display or retrieve title. Default true.
* @return string|void Title when retrieving, null when displaying or failure.
*/
function post_type_archive_title( $prefix = '', $display = true ) {
@ -1425,7 +1425,7 @@ function post_type_archive_title( $prefix = '', $display = true ) {
* @since 0.71
*
* @param string $prefix Optional. What to display before the title.
* @param bool $display Optional, default is true. Whether to display or retrieve title.
* @param bool $display Optional. Whether to display or retrieve title. Default true.
* @return string|void Title when retrieving.
*/
function single_cat_title( $prefix = '', $display = true ) {
@ -1442,7 +1442,7 @@ function single_cat_title( $prefix = '', $display = true ) {
* @since 2.3.0
*
* @param string $prefix Optional. What to display before the title.
* @param bool $display Optional, default is true. Whether to display or retrieve title.
* @param bool $display Optional. Whether to display or retrieve title. Default true.
* @return string|void Title when retrieving.
*/
function single_tag_title( $prefix = '', $display = true ) {
@ -1459,7 +1459,7 @@ function single_tag_title( $prefix = '', $display = true ) {
* @since 3.1.0
*
* @param string $prefix Optional. What to display before the title.
* @param bool $display Optional, default is true. Whether to display or retrieve title.
* @param bool $display Optional. Whether to display or retrieve title. Default true.
* @return string|void Title when retrieving.
*/
function single_term_title( $prefix = '', $display = true ) {
@ -1524,7 +1524,7 @@ function single_term_title( $prefix = '', $display = true ) {
* @global WP_Locale $wp_locale WordPress date and time locale object.
*
* @param string $prefix Optional. What to display before the title.
* @param bool $display Optional, default is true. Whether to display or retrieve title.
* @param bool $display Optional. Whether to display or retrieve title. Default true.
* @return string|void Title when retrieving.
*/
function single_month_title( $prefix = '', $display = true ) {
@ -1752,7 +1752,7 @@ function get_the_post_type_description() {
*
* @param string $url URL to archive.
* @param string $text Archive text description.
* @param string $format Optional, default is 'html'. Can be 'link', 'option', 'html', or custom.
* @param string $format Optional. Can be 'link', 'option', 'html', or custom. Default 'html'.
* @param string $before Optional. Content to prepend to the description. Default empty.
* @param string $after Optional. Content to append to the description. Default empty.
* @param bool $selected Optional. Set to true if the current page is the selected archive page.
@ -2080,8 +2080,8 @@ function calendar_week_mod( $num ) {
* @global WP_Locale $wp_locale WordPress date and time locale object.
* @global array $posts
*
* @param bool $initial Optional, default is true. Use initial calendar names.
* @param bool $echo Optional, default is true. Set to false for return.
* @param bool $initial Optional. Whether to use initial calendar names. Default true.
* @param bool $display Optional. Whether to display or return the calendar. Default true.
* @return void|string Void if `$echo` argument is true, calendar HTML if `$echo` is false.
*/
function get_calendar( $initial = true, $echo = true ) {
@ -2374,7 +2374,7 @@ function the_date_xml() {
* @param string $format Optional. PHP date format defaults to the date_format option if not specified.
* @param string $before Optional. Output before the date.
* @param string $after Optional. Output after the date.
* @param bool $echo Optional, default is display. Whether to echo the date or return it.
* @param bool $echo Optional. Whether to echo the date or return it. Default true.
* @return string|void String if retrieving.
*/
function the_date( $format = '', $before = '', $after = '', $echo = true ) {
@ -2453,7 +2453,7 @@ function get_the_date( $format = '', $post = null ) {
* @param string $format Optional. PHP date format defaults to the date_format option if not specified.
* @param string $before Optional. Output before the date.
* @param string $after Optional. Output after the date.
* @param bool $echo Optional, default is display. Whether to echo the date or return it.
* @param bool $echo Optional. Whether to echo the date or return it. Default true.
* @return string|void String if retrieving.
*/
function the_modified_date( $format = '', $before = '', $after = '', $echo = true ) {

View File

@ -257,8 +257,8 @@ function get_permalink( $post = 0, $leavename = false ) {
* @global WP_Rewrite $wp_rewrite WordPress rewrite component.
*
* @param int|WP_Post $id Optional. Post ID or post object. Default is the global `$post`.
* @param bool $leavename Optional, defaults to false. Whether to keep post name. Default false.
* @param bool $sample Optional, defaults to false. Is it a sample permalink. Default false.
* @param bool $leavename Optional. Whether to keep post name. Default false.
* @param bool $sample Optional. Is it a sample permalink. Default false.
* @return string|WP_Error The post permalink.
*/
function get_post_permalink( $id = 0, $leavename = false, $sample = false ) {

View File

@ -11,7 +11,7 @@
*
* @since 3.1.0
*
* @param int|object|null $post Post ID or post object. Optional, default is the current post from the loop.
* @param int|object|null $post Optional. Post ID or post object. Defaults to the current post in the loop.
* @return string|false The format if successful. False otherwise.
*/
function get_post_format( $post = null ) {
@ -42,8 +42,9 @@ function get_post_format( $post = null ) {
* @since 3.1.0
*
* @param string|array $format Optional. The format or formats to check.
* @param WP_Post|int|null $post Optional. The post to check. If not supplied, defaults to the current post if used in the loop.
* @return bool True if the post has any of the given formats (or any format, if no format specified), false otherwise.
* @param WP_Post|int|null $post Optional. The post to check. Defaults to the current post in the loop.
* @return bool True if the post has any of the given formats (or any format, if no format specified),
* false otherwise.
*/
function has_post_format( $format = array(), $post = null ) {
$prefixed = array();
@ -64,7 +65,7 @@ function has_post_format( $format = array(), $post = null ) {
*
* @param int|object $post The post for which to assign a format.
* @param string $format A format to assign. Use an empty string or array to remove all formats from the post.
* @return array|WP_Error|false WP_Error on error. Array of affected term IDs on success.
* @return array|WP_Error|false Array of affected term IDs on success. WP_Error on error.
*/
function set_post_format( $post, $format ) {
$post = get_post( $post );

View File

@ -238,7 +238,7 @@ function get_the_guid( $post = 0 ) {
* @since 0.71
*
* @param string $more_link_text Optional. Content for when there is more text.
* @param bool $strip_teaser Optional. Strip teaser content before the more text. Default is false.
* @param bool $strip_teaser Optional. Strip teaser content before the more text. Default false.
*/
function the_content( $more_link_text = null, $strip_teaser = false ) {
$content = get_the_content( $more_link_text, $strip_teaser );
@ -269,8 +269,8 @@ function the_content( $more_link_text = null, $strip_teaser = false ) {
* @global int $multipage Boolean indicator for whether multiple pages are in play.
*
* @param string $more_link_text Optional. Content for when there is more text.
* @param bool $strip_teaser Optional. Strip teaser content before the more text. Default is false.
* @param WP_Post|object|int $post Optional. WP_Post instance or Post ID/object. Default is null.
* @param bool $strip_teaser Optional. Strip teaser content before the more text. Default false.
* @param WP_Post|object|int $post Optional. WP_Post instance or Post ID/object. Default null.
* @return string
*/
function get_the_content( $more_link_text = null, $strip_teaser = false, $post = null ) {
@ -1566,9 +1566,9 @@ function walk_page_dropdown_tree( ...$args ) {
* @since 2.0.0
*
* @param int|WP_Post $id Optional. Post ID or post object.
* @param bool $fullsize Optional, default is false. Whether to use full size.
* @param bool $fullsize Optional. Whether to use full size. Default false.
* @param bool $deprecated Deprecated. Not used.
* @param bool $permalink Optional, default is false. Whether to include permalink.
* @param bool $permalink Optional. Whether to include permalink. Default false.
*/
function the_attachment_link( $id = 0, $fullsize = false, $deprecated = false, $permalink = false ) {
if ( ! empty( $deprecated ) ) {
@ -1592,7 +1592,7 @@ function the_attachment_link( $id = 0, $fullsize = false, $deprecated = false, $
* @param string|array $size Optional. Image size. Accepts any valid image size, or an array
* of width and height values in pixels (in that order).
* Default 'thumbnail'.
* @param bool $permalink Optional, Whether to add permalink to image. Default false.
* @param bool $permalink Optional. Whether to add permalink to image. Default false.
* @param bool $icon Optional. Whether the attachment is an icon. Default false.
* @param string|false $text Optional. Link text to use. Activated by passing a string, false otherwise.
* Default false.
@ -1804,7 +1804,7 @@ function get_page_template_slug( $post = null ) {
* @since 2.6.0
*
* @param int|object $revision Revision ID or revision object.
* @param bool $link Optional, default is true. Link to revisions's page?
* @param bool $link Optional. Whether to link to revision's page. Default true.
* @return string|false i18n formatted datetimestamp or localized 'Current Revision'.
*/
function wp_post_revision_title( $revision, $link = true ) {
@ -1845,7 +1845,7 @@ function wp_post_revision_title( $revision, $link = true ) {
* @since 3.6.0
*
* @param int|object $revision Revision ID or revision object.
* @param bool $link Optional, default is true. Link to revisions's page?
* @param bool $link Optional. Whether to link to revision's page. Default true.
* @return string|false gravatar, user, i18n formatted datetimestamp or localized 'Current Revision'.
*/
function wp_post_revision_title_expanded( $revision, $link = true ) {

View File

@ -811,7 +811,7 @@ function get_tax_sql( $tax_query, $primary_table, $primary_id_column ) {
* @param string $taxonomy Optional. Taxonomy name that $term is part of.
* @param string $output Optional. The required return type. One of OBJECT, ARRAY_A, or ARRAY_N, which correspond to
* a WP_Term object, an associative array, or a numeric array, respectively. Default OBJECT.
* @param string $filter Optional, default is raw or no WordPress defined filter will applied.
* @param string $filter Optional. How to sanitize term fields. Default 'raw'.
* @return WP_Term|array|WP_Error|null Object of the type specified by `$output` on success. When `$output` is 'OBJECT',
* a WP_Term instance is returned. If taxonomy does not exist, a WP_Error is
* returned. Returns null for miscellaneous failure.
@ -922,7 +922,7 @@ function get_term( $term, $taxonomy = '', $output = OBJECT, $filter = 'raw' ) {
* @param string $taxonomy Taxonomy name. Optional, if `$field` is 'term_taxonomy_id'.
* @param string $output Optional. The required return type. One of OBJECT, ARRAY_A, or ARRAY_N, which correspond to
* a WP_Term object, an associative array, or a numeric array, respectively. Default OBJECT.
* @param string $filter Optional, default is raw or no WordPress defined filter will applied.
* @param string $filter Optional. How to sanitize term fields. Default 'raw'.
* @return WP_Term|array|false WP_Term instance (or array) on success. Will return false if `$taxonomy` does not exist
* or `$term` was not found.
*/
@ -1044,7 +1044,8 @@ function get_term_children( $term_id, $taxonomy ) {
* @param string $field Term field to fetch.
* @param int|WP_Term $term Term ID or object.
* @param string $taxonomy Optional. Taxonomy Name. Default empty.
* @param string $context Optional, default is display. Look at sanitize_term_field() for available options.
* @param string $context Optional. How to sanitize term fields. Look at sanitize_term_field() for available options.
* Default 'display'.
* @return string|int|null|WP_Error Will return an empty string if $term is not an object or if $field is not set in $term.
*/
function get_term_field( $field, $term, $taxonomy = '', $context = 'display' ) {

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.5-alpha-48196';
$wp_version = '5.5-alpha-48197';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.

View File

@ -663,7 +663,7 @@ function wp_unregister_widget_control( $id ) {
* @global array $wp_registered_sidebars Registered sidebars.
* @global array $wp_registered_widgets Registered widgets.
*
* @param int|string $index Optional, default is 1. Index, name or ID of dynamic sidebar.
* @param int|string $index Optional. Index, name or ID of dynamic sidebar. Default 1.
* @return bool True, if widget sidebar was found and called. False if not found or not called.
*/
function dynamic_sidebar( $index = 1 ) {