Problem with wp_localize_script and wp_create_nonce
-
Hi,
when using your plugin i got a problem with the js of my plugin. My Plugin have to handle ajax_calls and so i send the wp-nonce per wp_localize_script among some other things to the js.
wp_localize_script( 'mypluginajax', 'myplugin_ajax', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ), 'nonce' => wp_create_nonce('myplugin') ) );
i figured out, that your plugin stores those infos in the database in the field ‘extra’ and deliver this out, when the webpage request the script.
this results in the behavior that the ajax calls to my plugin got an 403-error because the nonce isnt valid.
i set up a filter with your plugin that the script and style of my plugin loaded only at the specific page (not home)
is there a setting or a trick, where the ‘extra’ field will be updated or the wp_localize_script-output be used instead ?
im happy to hear from you, also you can email me for further info.
Greetings
Ralf J?hnrich
- The topic ‘Problem with wp_localize_script and wp_create_nonce’ is closed to new replies.