> For the complete documentation index, see [llms.txt](https://learnphp.gitbook.io/learnphp/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://learnphp.gitbook.io/learnphp/wordpress-advand/cach-tao-action-nonce-tren-duong-dan-ok.md).

# Cách tạo action, nonce,check\_ajax\_referer trên đường dẫn (ok)

![](https://1113999984-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M84NwP_L_qEsBHOa2xo%2F-MSCSNQLseB0zdIs5pHz%2F-MSCVrEjufNC96jE4-hi%2FScreenshot_1.jpg?alt=media\&token=8f2aa9d3-9278-489e-8381-552707e7725d)

C:\xampp\htdocs\test\wp-content\plugins\plugin-name\admin\partials\form\_ct.php

```
<form method="post" action="<?php echo add_query_arg(array('action'=>$this->plugin_name . '_ajax_themes_save'),  admin_url('admin-ajax.php')) ?>">
    <input type="hidden" value="<?php echo wp_create_nonce($this->plugin_name . '_them_ajax'); ?>" name="<?php echo $this->plugin_name ?>_nonce"/>
    <?php $form = new WPF_Form($this->plugin_name,$this->version,$cpt_id); 
        $form->form();
    ?>
    <p class="submit">
        <button id="<?php echo $this->plugin_name ?>_submit" class="button button-primary"><?php _e('Save', 'wpf') ?></button>
    </p>
    <div id="<?php echo $this->plugin_name ?>_success_text" class="updated"></div>
	<div class="<?php echo $this->plugin_name ?>_wait"></div>
</form>
```

C:\xampp\htdocs\test\wp-content\plugins\themify-wc-product-filter\admin\class-wpf-admin.php

```
public function save_themplate(){
        check_ajax_referer($this->plugin_name .'_them_ajax', $this->plugin_name .'_nonce', true);
        $form = new WPF_Form($this->plugin_name,$this->version);
        $result = $form->save_themplate($_POST);
        if($result){
           echo  wp_json_encode($result);
        }
        wp_die();
    }
```
