From 194b2346fe77d60d2952199e686784e9ec9e5544 Mon Sep 17 00:00:00 2001 From: George Mamadashvili Date: Mon, 26 Apr 2021 13:18:22 +0400 Subject: [PATCH] Navigation Editor: use 'ajaxurl' global in batchSave action (#31028) --- packages/edit-navigation/src/store/actions.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/edit-navigation/src/store/actions.js b/packages/edit-navigation/src/store/actions.js index de4ec3e1691c14..5af226c4471353 100644 --- a/packages/edit-navigation/src/store/actions.js +++ b/packages/edit-navigation/src/store/actions.js @@ -26,6 +26,8 @@ import { computeCustomizedAttribute, } from './utils'; +const { ajaxurl } = window; + /** * Creates a menu item for every block that doesn't have an associated menuItem. * Requests POST /wp/v2/menu-items once for every menu item created. @@ -184,7 +186,7 @@ function* batchSave( menuId, menuItemsByClientId, navigationBlock ) { ); return yield apiFetch( { - url: '/wp-admin/admin-ajax.php', + url: ajaxurl || '/wp-admin/admin-ajax.php', method: 'POST', body, } );