wp-graphql / wp-graphql-jwt-authentication

Authentication for WPGraphQL using JWT (JSON Web Tokens)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Using ACF get_field causes infinite recursion

spiralni opened this issue · comments

I am trying to get the secret key configured in a setting using the ACF plugin (https://www.advancedcustomfields.com/)
But I notice, when the auth token is received and the get_field is called, there is an infinite loop that breaks the site.

 add_filter( 'graphql_jwt_auth_secret_key', function() {
            return get_field( 'jwt_auth_secret_key', 'option' );
        });

Stacktrace:


[07-May-2021 03:34:29 UTC] PHP Fatal error:  Uncaught Error: Maximum function nesting level of '256' reached, aborting! in C:\MAMP\htdocs\drnoxdev\wp-includes\plugin.php:181
Stack trace:
#0 C:\MAMP\htdocs\drnoxdev\wp-content\plugins\advanced-custom-fields-pro\includes\api\api-helpers.php(2588): apply_filters('acf/pre_load_po...', NULL, 'option')
#1 C:\MAMP\htdocs\drnoxdev\wp-content\plugins\advanced-custom-fields-pro\includes\api\api-template.php(23): acf_get_valid_post_id('option')

Any comment?