From 036d5d7d15e4b9fd6f5eb84ab9b863c0f2a84700 Mon Sep 17 00:00:00 2001 From: Simon Weber Date: Thu, 15 May 2025 12:17:00 +0200 Subject: [PATCH] do not modify rest responses, belonging to the WPML plugin Fixes an issue, where WPMLs dashboard.js does not expect the _links object in its rest responses. --- inc/namespace.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/inc/namespace.php b/inc/namespace.php index f327cb5..f83778b 100644 --- a/inc/namespace.php +++ b/inc/namespace.php @@ -311,6 +311,11 @@ function filter_rest_request_after_callbacks( $result, array $handler, WP_REST_R return $result; } + // skip requests to wpml api + if(preg_match('/^\/wpml\//', $request->get_route())){ + return $result; + } + $data = $result->get_data(); if ( ! is_array( $data ) || ! isset( $data[ REST_PARAM ] ) ) {