Friday, July 15, 2022
HomeWordPress Developmentplugin improvement - The place to make use of nonce

plugin improvement – The place to make use of nonce


I’m studying WordPress Plugin Growth. My Code is like under.

class Admin
{
    
    public operate __construct()
    {        
        add_action( 'admin_menu', [$this,'news_meta_boxes'] );
    }

    public operate news_meta_boxes()
    {
        add_meta_box('news_settings', 'Information Settings', [ $this, 'post_settings_html' ], 'information', 'regular', 'default');
        add_meta_box('display_settings', 'Show Settings', [ $this, 'display_settings_html' ], 'information', 'regular', 'default');
        add_meta_box('style_settings', 'Coloration Settings', [ $this, 'style_settings_html' ], 'information', 'regular', 'default');
    }
    

    public operate post_settings_html($put up)
    {
        wp_nonce_field(basename(__FILE__), 'news_nonce');
    }


    public operate display_settings_html($put up)
    {
        
        wp_nonce_field(basename(__FILE__), 'news_nonce');
    }


    public operate style_settings_html($put up)
    {
        wp_nonce_field(basename(__FILE__), 'news_nonce');
    }
}

Ought to I take advantage of wp_nonce_field in each Metabox name again operate ?

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments