admin管理员组文章数量:1418591
In my plugin list of email page, I need to remove email using Ajax call. I can delete it using Ajax call but how I can secure this ajax call?
I need to create nonce, right? Well, then how?
If I create a nonce inside foreach loop to the data attribute then it's showing me the same value!
foreach ( $results as $result ) {
echo "<tr>";
echo "<td>" . intval ( $count )."</td>";
echo "<td>" . esc_html ( $result['email_address'] ) ."</td>";
echo "<td>" . esc_html ( $result['added_time'] ) ."</td>";
echo "<td><a href='?page=simple-newsletter-send-email&e=".esc_url ( $result['email_address'] ) ."'>Send Email</a> | <a href='#' data-nonce='".wp_create_nonce( 'sn_email_list_tab' )."' id='sn_remove_email'>Remove</a></td>";
echo "</tr>";
$count++;
}
My questions are
1) what is the correct way to secure the ajax call in this scenario?
2) Is there any way to add a nonce to the ajax URL?
Email List with remove button:
本文标签: pluginsHow to create WordPress nonce in the foreach loop
版权声明:本文标题:plugins - How to create WordPress nonce in the foreach loop? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745296992a2652139.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论