I am developing a wordpress plugin using the wordpress boilerplate template. Additionally, I am using Redux Framework as an options framework. I load the options-init.php in the load_dependencies() function of the main include file.
Everything works fine. However, when calling wp_create_nonce in options-init.php I get a Fatal error: Uncaught Error: Call to undefined function wp_create_nonce()
Why is it and how to solve it?
I found the solution myself, although not sure if it is correct/best practice.
I moved the include of the redux framework into a seperate class which I call via action hook on ''plugins_loaded'
//Initiate Redux Framework $this->loader->add_action( 'plugins_loaded', $plugin_admin_redux, 'init_redux_framework' );
Inside the method init_redux_framework() I just put the require once to the admin-init.php
Interestingly though that adding it on 'init' instead of 'plugins_loaded' was too late for Redux to be initialized.