From 33dc86e8e56015a130517182bd96f40aea640408 Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Mon, 16 Apr 2018 10:41:34 +0100 Subject: [PATCH] Fix JS error when ap.apiRequest has no preload data (#6194) --- lib/compat.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/compat.php b/lib/compat.php index 23ceedb0f011b6..553730018e7bcc 100644 --- a/lib/compat.php +++ b/lib/compat.php @@ -126,7 +126,7 @@ function getStablePath( path ) { wp.apiRequest = function( request ) { var method, path; - if ( typeof request.path === 'string' ) { + if ( typeof request.path === 'string' && window._wpAPIDataPreload ) { method = request.method || 'GET'; path = getStablePath( request.path );