API call before theme loaded
-
Hello!
I’ve implemented some custom API endpoints for a headless WP. Some endpoints are secured using a JWT.
However, once Wordfence is activated, I start to observe that the API logic is triggered before the theme function is loaded. Therefore the checks are failing and the API block the request although it should have been accepted.
To demonstrate, I’ve included
error_log('setup now');
in andafter_setup_theme
add_action anderror_log('api access check for url:');
when the api check for the JWTHere is the result in the error log
WITHOUT WORDFENCE ACTIVATED [15-May-2023 10:56:54 UTC] setup now [15-May-2023 10:56:54 UTC] setup now [15-May-2023 10:56:54 UTC] jwt called [15-May-2023 10:56:54 UTC] api access check for url: [15-May-2023 10:56:54 UTC] /wp-json/realitic/v1/get_forms [15-May-2023 10:56:54 UTC] jwt called [15-May-2023 10:56:54 UTC] api access check for url: [15-May-2023 10:56:54 UTC] /wp-json/realitic/v1/get_forms WITH WORDFENCE ACTIVATED [15-May-2023 10:57:54 UTC] api access check for url: [15-May-2023 10:57:54 UTC] /wp-json/realitic/v1/get_forms [15-May-2023 10:57:54 UTC] setup now [15-May-2023 10:57:54 UTC] setup now [15-May-2023 10:57:54 UTC] jwt called [15-May-2023 10:57:54 UTC] api access check for url: [15-May-2023 10:57:54 UTC] /eurohpc_backend/wp-json/realitic/v1/get_forms
Any idea why this is the case and how to fix this?
Also, apparently, all API calls are triggered twice, which is the default behavior right?
Thanks a lot for your help
- The topic ‘API call before theme loaded’ is closed to new replies.