This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function findObjectWithKey(object, key, multiple = false, _recursiveData) { | |
var value, path = _recursiveData?.path || []; | |
Object.keys(object).some(function(k) { | |
if (k === key) { | |
value = object; | |
path.push("|"); | |
if (!multiple) { | |
return true; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function restoreNativeFunctionFromPolyfillOverride(callback) { | |
var d = document; | |
var dE = d.documentElement; | |
var e = d.createElement("iframe"); | |
e.style.display = "none"; | |
dE.appendChild(e); | |
callback(window, e.contentWindow); | |
dE.removeChild(e); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if ( !function_exists( 'is_rest' ) ) { | |
/** | |
* Checks if the current request is a WP REST API request. | |
* | |
* Case #1: After WP_REST_Request initialisation | |
* Case #2: Support "plain" permalink settings and check if `rest_route` starts with `/` | |
* Case #3: It can happen that WP_Rewrite is not yet initialized, | |
* so do this (wp-settings.php) |