Forum Replies Created

Viewing 1 replies (of 1 total)
  • @daviddorsettech You’re not going to be able to whitelist anything from the theme. Your call to plugins_loaded hook happens after the hook has fired. From the plugin docs –

    “Every call to the server (except the token creation some default whitelist) will be intercepted. However, you might need to whitelist some endpoints. You can use jwt_auth_whitelist filter to do it. Please simply add this filter directly (without hook). Or, you can add it to plugins_loaded. Adding this filter inside init (or later) will not work.

    If you’re adding the filter inside theme and the whitelisting doesn’t work, please create a small 1 file plugin and add your filter there.

    Here is the code that I got to work by calling inside plugin without hook, note the different filter (it’s the only one that worked for me):

    \add_filter('jwt_auth_default_whitelist', function ($whitelist){
                
                $base = home_url( '/wp-json/', 'relative');
                $new_whitelist = array(
                    $base . 'contact-form-7',
                );
                return array_unique( array_merge( $whitelist, $new_whitelist ) );
    
            });
        }
Viewing 1 replies (of 1 total)