wp_comment_form_unfiltered_html_nonce()
Display form token for unfiltered comments.
Description
Will only display nonce token if the current user has permissions for unfiltered html. Won’t display the token for other users.
The function was backported to WP-2.0.10 and was added to versions WP-2.1.3 and above. Does not exist in versions prior to WP-2.0.10 in the WP-2.0 branch and in the WP-2.1 branch, prior to WP-2.1.3. Technically added in WP-2.2.0.
Backported to WP-2.0.10.
Source
File: wp-includes/comment-template.php
function wp_comment_form_unfiltered_html_nonce() {
$post = get_post();
$post_id = $post ? $post->ID : 0;
if ( current_user_can( 'unfiltered_html' ) ) {
wp_nonce_field( 'unfiltered-html-comment_' . $post_id, '_wp_unfiltered_html_comment_disabled', false );
echo "<script>(function(){if(window===window.parent){document.getElementById('_wp_unfiltered_html_comment_disabled').name='_wp_unfiltered_html_comment';}})();</script>\n";
}
}
Changelog
Version | Description |
---|---|
WP-2.1.3 | Introduced. |