wp_nonce_field()

関数の概要

wp_nonce_field()はWordPressでセキュリティ用のワンタイムトークン (nonce) フィールドを生成するための関数です。この関数を使用することで、フォーム送信時にセキュリティトークンを含めることができます。

パラメータの説明

  • $action (string) – nonceのアクション名を指定します。
  • $name (string) – nonceフィールドの名前を指定します。

戻り値

nonceフィールドを含むHTMLコードを生成します。

使用例

<?php
    wp_nonce_field( 'my_action', 'my_nonce_field' );
?>

関連する関数

  • wp_create_nonce() – nonceを生成する関数。
  • wp_verify_nonce() – nonceの検証を行う関数。