REST API: Some documentation and test improvements for `update_menu_item_cache()`:

* Make the function description more specific, for consistency with other similar functions.
* Add a `@since` note for the `$update_menu_item_cache` parameter of `WP_Query::parse_query()`.
* Add missing `@covers` tags for the unit tests.

Follow-up to [53504].

See #55620.
Built from https://develop.svn.wordpress.org/trunk@53508


git-svn-id: http://core.svn.wordpress.org/trunk@53097 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2022-06-15 13:37:10 +00:00
parent 84a8194200
commit a42b89fc71
3 changed files with 5 additions and 3 deletions

View File

@ -627,6 +627,7 @@ class WP_Query {
* @since 4.9.0 Introduced the `$comment_count` parameter. * @since 4.9.0 Introduced the `$comment_count` parameter.
* @since 5.1.0 Introduced the `$meta_compare_key` parameter. * @since 5.1.0 Introduced the `$meta_compare_key` parameter.
* @since 5.3.0 Introduced the `$meta_type_key` parameter. * @since 5.3.0 Introduced the `$meta_type_key` parameter.
* @since 6.1.0 Introduced the `$update_menu_item_cache` parameter.
* *
* @param string|array $query { * @param string|array $query {
* Optional. Array or string of Query parameters. * Optional. Array or string of Query parameters.

View File

@ -753,11 +753,11 @@ function wp_get_nav_menu_items( $menu, $args = array() ) {
} }
/** /**
* Prime all linked objects to menu items. * Updates post and term caches for all linked objects for a list of menu items.
* *
* @since 6.1.0 * @since 6.1.0
* *
* @param WP_Post[] $menu_items Array post objects of menu items. * @param WP_Post[] $menu_items Array of menu item post objects.
*/ */
function update_menu_item_cache( $menu_items ) { function update_menu_item_cache( $menu_items ) {
$post_ids = array(); $post_ids = array();
@ -767,6 +767,7 @@ function update_menu_item_cache( $menu_items ) {
if ( 'nav_menu_item' !== $menu_item->post_type ) { if ( 'nav_menu_item' !== $menu_item->post_type ) {
continue; continue;
} }
$object_id = get_post_meta( $menu_item->ID, '_menu_item_object_id', true ); $object_id = get_post_meta( $menu_item->ID, '_menu_item_object_id', true );
$type = get_post_meta( $menu_item->ID, '_menu_item_type', true ); $type = get_post_meta( $menu_item->ID, '_menu_item_type', true );

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '6.1-alpha-53507'; $wp_version = '6.1-alpha-53508';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.