[wp-trac] [WordPress Trac] #51301: Add class field to wp_nonce_field

WordPress Trac noreply at wordpress.org
Mon Sep 14 01:38:57 UTC 2020


#51301: Add class field to wp_nonce_field
-----------------------------------+------------------------------
 Reporter:  dingo_d                |       Owner:  (none)
     Type:  enhancement            |      Status:  new
 Priority:  normal                 |   Milestone:  Awaiting Review
Component:  General                |     Version:
 Severity:  normal                 |  Resolution:
 Keywords:  has-patch 2nd-opinion  |     Focuses:
-----------------------------------+------------------------------

Comment (by dd32):

 Given the `id` that should be unique per page, and/or the fact that this
 should only be used within a `form` element I'm not sure an additional
 class here is actually much of a benefit given it's a non-displayed
 element.

 I suspect, that the use-case here is probably one that would be better
 done through using either a `data-nonce=".. wp_create_nonce(...) .."`
 attribute or a `wp_localize_script( 'my-script', 'myScriptData', array(
 'nonce' => wp_create_nonce(...) );`

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/51301#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list