From f749bbac90c0e7d5adb1681bed71932b05372997 Mon Sep 17 00:00:00 2001 From: VladimirAus Date: Mon, 21 Jul 2025 02:18:29 +1000 Subject: [PATCH 1/3] 58849: Document supported for register_rest_route(). --- src/wp-includes/rest-api.php | 55 ++++++++++++++++++++++++++++++++---- 1 file changed, 50 insertions(+), 5 deletions(-) diff --git a/src/wp-includes/rest-api.php b/src/wp-includes/rest-api.php index 836e0e5ec8a23..ae20e18c0a2d8 100644 --- a/src/wp-includes/rest-api.php +++ b/src/wp-includes/rest-api.php @@ -19,17 +19,62 @@ * * Note: Do not use before the {@see 'rest_api_init'} hook. * + * Example usage: + * ```php + * add_action( 'rest_api_init', function () { + * register_rest_route( 'my-plugin/v1', '/settings', array( + * 'methods' => 'GET', + * 'callback' => 'my_plugin_get_settings', + * 'permission_callback' => function () { + * // Only allow users who can manage options. + * return current_user_can( 'manage_options' ); + * }, + * ) ); + * } ); + * ``` + * * @since 4.4.0 * @since 5.1.0 Added a `_doing_it_wrong()` notice when not called on or after the `rest_api_init` hook. * @since 5.5.0 Added a `_doing_it_wrong()` notice when the required `permission_callback` argument is not set. * * @param string $route_namespace The first URL segment after core prefix. Should be unique to your package/plugin. - * @param string $route The base URL for route you are adding. - * @param array $args Optional. Either an array of options for the endpoint, or an array of arrays for - * multiple methods. Default empty array. - * @param bool $override Optional. If the route already exists, should we override it? True overrides, - * false merges (with newer overriding if duplicate keys exist). Default false. + * @param string $route The base URL for route to be added with support for regular expressions. + * Example: '/posts/(?P[\d]+)'. + * @param array $args { + * Optional. An array of options for the endpoint. This can be a single associative + * array for one endpoint, or an array of associative arrays for multiple endpoints. + * Default empty array. + * + * @type string|array $methods Required. HTTP method(s) the route + * responds to. Can be a string or an array + * (e.g. 'GET', 'POST', ['GET', 'POST']). + * @type callable $callback Required. The callback function to handle + * the request. Accepts a `WP_REST_Request` + * and returns a `WP_REST_Response` or array. + * @type callable $permission_callback Required. A function to check if the + * request has permission. Must return + * `true` or `WP_Error`. + * @type array $args { + * Optional. An associative array of argument schema for validation and + * sanitization. + * Keys are argument names, values are arrays of argument options: + * + * @type bool $required Whether this parameter is required. + * Default false. + * @type string $type Data type: 'string', 'integer', 'boolean', + * 'array', etc. + * @type mixed $default Default value if the parameter is not + * provided. + * @type callable $validate_callback Callback to validate the parameter. + * @type callable $sanitize_callback Callback to sanitize the parameter. + * @type array $enum Allowed values (enumeration). + * @type array $items Schema for array items if type is 'array'. + * } + * } + * @param bool $override Optional. True to override existing route, false to merge (with newer overriding + * if duplicate keys exist). Default false. * @return bool True on success, false on error. + * */ function register_rest_route( $route_namespace, $route, $args = array(), $override = false ) { if ( empty( $route_namespace ) ) { From efb036cfbba2f3d804bf33dd71f8e046cfde6e7e Mon Sep 17 00:00:00 2001 From: VladimirAus Date: Fri, 25 Jul 2025 12:51:52 +1000 Subject: [PATCH 2/3] Reveretd rest API docs. --- src/wp-includes/rest-api.php | 55 ++++-------------------------------- 1 file changed, 5 insertions(+), 50 deletions(-) diff --git a/src/wp-includes/rest-api.php b/src/wp-includes/rest-api.php index ae20e18c0a2d8..836e0e5ec8a23 100644 --- a/src/wp-includes/rest-api.php +++ b/src/wp-includes/rest-api.php @@ -19,62 +19,17 @@ * * Note: Do not use before the {@see 'rest_api_init'} hook. * - * Example usage: - * ```php - * add_action( 'rest_api_init', function () { - * register_rest_route( 'my-plugin/v1', '/settings', array( - * 'methods' => 'GET', - * 'callback' => 'my_plugin_get_settings', - * 'permission_callback' => function () { - * // Only allow users who can manage options. - * return current_user_can( 'manage_options' ); - * }, - * ) ); - * } ); - * ``` - * * @since 4.4.0 * @since 5.1.0 Added a `_doing_it_wrong()` notice when not called on or after the `rest_api_init` hook. * @since 5.5.0 Added a `_doing_it_wrong()` notice when the required `permission_callback` argument is not set. * * @param string $route_namespace The first URL segment after core prefix. Should be unique to your package/plugin. - * @param string $route The base URL for route to be added with support for regular expressions. - * Example: '/posts/(?P[\d]+)'. - * @param array $args { - * Optional. An array of options for the endpoint. This can be a single associative - * array for one endpoint, or an array of associative arrays for multiple endpoints. - * Default empty array. - * - * @type string|array $methods Required. HTTP method(s) the route - * responds to. Can be a string or an array - * (e.g. 'GET', 'POST', ['GET', 'POST']). - * @type callable $callback Required. The callback function to handle - * the request. Accepts a `WP_REST_Request` - * and returns a `WP_REST_Response` or array. - * @type callable $permission_callback Required. A function to check if the - * request has permission. Must return - * `true` or `WP_Error`. - * @type array $args { - * Optional. An associative array of argument schema for validation and - * sanitization. - * Keys are argument names, values are arrays of argument options: - * - * @type bool $required Whether this parameter is required. - * Default false. - * @type string $type Data type: 'string', 'integer', 'boolean', - * 'array', etc. - * @type mixed $default Default value if the parameter is not - * provided. - * @type callable $validate_callback Callback to validate the parameter. - * @type callable $sanitize_callback Callback to sanitize the parameter. - * @type array $enum Allowed values (enumeration). - * @type array $items Schema for array items if type is 'array'. - * } - * } - * @param bool $override Optional. True to override existing route, false to merge (with newer overriding - * if duplicate keys exist). Default false. + * @param string $route The base URL for route you are adding. + * @param array $args Optional. Either an array of options for the endpoint, or an array of arrays for + * multiple methods. Default empty array. + * @param bool $override Optional. If the route already exists, should we override it? True overrides, + * false merges (with newer overriding if duplicate keys exist). Default false. * @return bool True on success, false on error. - * */ function register_rest_route( $route_namespace, $route, $args = array(), $override = false ) { if ( empty( $route_namespace ) ) { From 8b04def213ccb37be0bddd6024b61e4c9955e192 Mon Sep 17 00:00:00 2001 From: VladimirAus Date: Thu, 29 Jan 2026 22:52:10 +1000 Subject: [PATCH 3/3] [#47051] Screen reader fix. --- src/wp-content/themes/twentynineteen/inc/icon-functions.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/wp-content/themes/twentynineteen/inc/icon-functions.php b/src/wp-content/themes/twentynineteen/inc/icon-functions.php index 2ac4cffd6bd21..a6d14e214e279 100644 --- a/src/wp-content/themes/twentynineteen/inc/icon-functions.php +++ b/src/wp-content/themes/twentynineteen/inc/icon-functions.php @@ -80,7 +80,8 @@ function twentynineteen_add_dropdown_icons( $item_output, $item, $depth, $args ) // Inject the keyboard_arrow_left SVG inside the parent nav menu item, and let the item link to the parent item. // @todo Only do this for nested submenus? If on a first-level submenu, then really the link could be "#" since the desire is to remove the target entirely. $link = sprintf( - '', + '', + esc_attr( sprintf( __( 'Expand child menu for %s', 'twentynineteen' ), $item->title ) ), $icon ); }