test if wp is loaded for views
fix somes typos
use correct nonce functions, minor changes