Docs: Update various DocBlocks and inline comments per the documentation standards.

Includes minor formatting edits for consistency.

Follow-up to [53/tests], [12179], [12946], [35288], [37884], [38810], [38928], [46596], [48131], [52955], [53548], [53813], [53873], [54118], [54316], [54420], [54421], [54803].

See #56792.

git-svn-id: https://develop.svn.wordpress.org/trunk@54855 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2022-11-17 18:13:47 +00:00
parent a71d7373ad
commit acbbee8a11
20 changed files with 99 additions and 92 deletions

View File

@@ -553,7 +553,7 @@ class WP_REST_Server {
* Converts a response to data to send.
*
* @since 4.4.0
* @since 5.4.0 The $embed parameter can now contain a list of link relations to include.
* @since 5.4.0 The `$embed` parameter can now contain a list of link relations to include.
*
* @param WP_REST_Response $response Response object.
* @param bool|string[] $embed Whether to embed all links, a filtered list of link relations, or no links.
@@ -677,7 +677,7 @@ class WP_REST_Server {
* Embeds the links from the data into the request.
*
* @since 4.4.0
* @since 5.4.0 The $embed parameter can now contain a list of link relations to include.
* @since 5.4.0 The `$embed` parameter can now contain a list of link relations to include.
*
* @param array $data Data from the request.
* @param bool|string[] $embed Whether to embed all links or a filtered list of link relations.
@@ -759,7 +759,7 @@ class WP_REST_Server {
* data instead.
*
* @since 4.4.0
* @since 6.0.0 The $embed parameter can now contain a list of link relations to include
* @since 6.0.0 The `$embed` parameter can now contain a list of link relations to include.
*
* @param WP_REST_Response $response Response object.
* @param bool|string[] $embed Whether to embed all links, a filtered list of link relations, or no links.

View File

@@ -659,11 +659,9 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
&& in_array( $prepared_post->post_status, array( 'draft', 'pending' ), true )
) {
/*
* `wp_unique_post_slug()` returns the same
* slug for 'draft' or 'pending' posts.
* `wp_unique_post_slug()` returns the same slug for 'draft' or 'pending' posts.
*
* To ensure that a unique slug is generated,
* pass the post data with the 'publish' status.
* To ensure that a unique slug is generated, pass the post data with the 'publish' status.
*/
$prepared_post->post_name = wp_unique_post_slug(
$prepared_post->post_name,
@@ -862,15 +860,19 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
}
/*
* `wp_unique_post_slug()` returns the same
* slug for 'draft' or 'pending' posts.
* `wp_unique_post_slug()` returns the same slug for 'draft' or 'pending' posts.
*
* To ensure that a unique slug is generated,
* pass the post data with the 'publish' status.
* To ensure that a unique slug is generated, pass the post data with the 'publish' status.
*/
if ( ! empty( $post->post_name ) && in_array( $post_status, array( 'draft', 'pending' ), true ) ) {
$post_parent = ! empty( $post->post_parent ) ? $post->post_parent : 0;
$post->post_name = wp_unique_post_slug( $post->post_name, $post->ID, 'publish', $post->post_type, $post_parent );
$post->post_name = wp_unique_post_slug(
$post->post_name,
$post->ID,
'publish',
$post->post_type,
$post_parent
);
}
// Convert the post object to an array, otherwise wp_update_post() will expect non-escaped input.