EvanAgee / vuejs-wordpress-theme-starter

A WordPress theme with the guts ripped out and replaced with Vue.
https://vuewp.com/
1.6k stars 281 forks source link

X-CSRF-TOKEN #18

Closed samizarraa closed 6 years ago

samizarraa commented 6 years ago

window.WordPress.csrfToken ?! window.WordPress is undefined

samizarraa commented 6 years ago

Hi Just i want to ask about this line you wrote it in bootstrap file inside your app

'X-CSRF-TOKEN': window.WordPress.csrfToken,

I think it should be like this 'X-WP-Nonce': window.restAPI.nonce, and in theme function file we should add this wp_localize_script( 'app.js', 'restAPI', array( 'nonce' => wp_create_nonce( 'wp_rest' ) ) );

That's right ?