Only load API scripts on REST requests

This commit is contained in:
Tetrakern 2024-06-18 10:09:13 +02:00
parent 6c73838122
commit 48debdf213

View File

@ -583,7 +583,15 @@ require_once __DIR__ . '/includes/functions/_setup-roles.php';
*/
if ( get_option( 'fictioneer_enable_storygraph_api' ) ) {
add_action(
'rest_api_init',
function () {
if ( defined( 'REST_REQUEST' ) && REST_REQUEST ) {
require_once __DIR__ . '/includes/functions/_api.php';
}
},
1
);
}
/**