Where to use nonce
-
I am learning WordPress Plugin Development. My Code is like below.
class Admin { public function __construct() { add_action( 'admin_menu', [$this,'news_meta_boxes'] ); } public function news_meta_boxes() { add_meta_box('news_settings', 'News Settings', [ $this, 'post_settings_html' ], 'news', 'normal', 'default'); add_meta_box('display_settings', 'Display Settings', [ $this, 'display_settings_html' ], 'news', 'normal', 'default'); add_meta_box('style_settings', 'Color Settings', [ $this, 'style_settings_html' ], 'news', 'normal', 'default'); } public function post_settings_html($post) { wp_nonce_field(basename(__FILE__), 'news_nonce'); } public function display_settings_html($post) { wp_nonce_field(basename(__FILE__), 'news_nonce'); } public function style_settings_html($post) { wp_nonce_field(basename(__FILE__), 'news_nonce'); } }
Should I use
wp_nonce_field
in every Metabox call back function ?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Where to use nonce’ is closed to new replies.