diff --git a/src/wp-includes/rest-api.php b/src/wp-includes/rest-api.php
index 7aa2534520..1c0a46fd2d 100644
--- a/src/wp-includes/rest-api.php
+++ b/src/wp-includes/rest-api.php
@@ -38,26 +38,55 @@ function register_rest_route( $route_namespace, $route, $args = array(), $overri
* and namespace indexes. If you really need to register a
* non-namespaced route, call `WP_REST_Server::register_route` directly.
*/
- _doing_it_wrong( 'register_rest_route', __( 'Routes must be namespaced with plugin or theme name and version.' ), '4.4.0' );
+ _doing_it_wrong(
+ __FUNCTION__,
+ sprintf(
+ /* translators: 1: string value of the namespace, 2: string value of the route. */
+ __( 'Routes must be namespaced with plugin or theme name and version. Instead there seems to be an empty namespace \'%1$s\' for route \'%2$s\'.' ),
+ '' . $route_namespace . '',
+ '' . $route . ''
+ ),
+ '4.4.0'
+ );
return false;
} elseif ( empty( $route ) ) {
- _doing_it_wrong( 'register_rest_route', __( 'Route must be specified.' ), '4.4.0' );
+ _doing_it_wrong(
+ __FUNCTION__,
+ sprintf(
+ /* translators: 1: string value of the namespace, 2: string value of the route. */
+ __( 'Route must be specified. Instead within the namespace \'%1$s\', there seems to be an empty route \'%2$s\'.' ),
+ '' . $route_namespace . '',
+ '' . $route . ''
+ ),
+ '4.4.0'
+ );
return false;
}
$clean_namespace = trim( $route_namespace, '/' );
if ( $clean_namespace !== $route_namespace ) {
- _doing_it_wrong( __FUNCTION__, __( 'Namespace must not start or end with a slash.' ), '5.4.2' );
+ _doing_it_wrong(
+ __FUNCTION__,
+ sprintf(
+ /* translators: 1: string value of the namespace, 2: string value of the route. */
+ __( 'Namespace must not start or end with a slash. Instead namespace \'%1$s\' for route \'%2$s\' seems to contain a slash.' ),
+ '' . $route_namespace . '',
+ '' . $route . ''
+ ),
+ '5.4.2'
+ );
}
if ( ! did_action( 'rest_api_init' ) ) {
_doing_it_wrong(
- 'register_rest_route',
+ __FUNCTION__,
sprintf(
- /* translators: %s: rest_api_init */
- __( 'REST API routes must be registered on the %s action.' ),
- 'rest_api_init'
+ /* translators: 1: rest_api_init, 2: string value of the namespace, 3: string value of the route. */
+ __( 'REST API routes must be registered on the %1$s action. Instead route \'%3$s\' with namespace \'%2$s\' was not registered on this action.' ),
+ 'rest_api_init',
+ '' . $route_namespace . '',
+ '' . $route . ''
),
'5.1.0'
);