Do Not Display Comments HTML Tags
in Functions
as comment_form, how-to, WordPress
A standard function found in many themes is the comment_form. This is a core function of WordPress that produces a standard comment form generally consisting of text fields for the name and email address and a textarea for the actual comment. You will also find there are some standard text outputs produced by this function as well, one of those is the allowed HTML tags that can be used in the form.
You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
If you do not want to display this text it is actually very easy to do. It can be done with a line of CSS or a minor edit to the theme in question. The following is based on using the comment_form function in its default state:
<?php comment_form(); ?>
To hide the message above with CSS, add one of the following to the end of your style.css file:
p.form-allowed-tags { display: none; }
p.form-allowed-tags { visibility: hidden; }
Using the display property “removes” the block of text whereas using the visibility property simply “hides” the text leaving the block being filled with nothing. Which method is best will be more due to aesthetics than anything else.
If you want to edit your theme files, look into the comments.php template file (again a standard default naming convention, your theme may vary), and find the default code noted above and change it to the following:
<?php comment_form( 'comment_notes_after=' ); ?>
Always remember, any edits you make to the theme may be over-written with the theme’s next update … always back-up your work.




Remove Comment Form Website Section
in Functions, Tips
as add_filter, comment_form, how-to, WordPress
From time to time an interesting Five-Minute-FixTM comes along that sparks a great reason to add another WordPress Tips post. The idea for this tip started with this comment at BuyNowShop.com:
The solution may be obvious to some and can be readily derived from the information found on the WordPress codex page for the `comment_form` function, but if you are new to WordPress and/or not familiar with writing a function to use with `add_filter`, here is a very simple and working snippet to use in your theme:
function wpfa_remove_comment_website_section(){ $commenter = wp_get_current_commenter(); $req = get_option( 'require_name_email' ); $aria_req = ( $req ? " aria-required='true'" : '' ); $fields = array( 'author' => '<p class="comment-form-author">' . '<label for="author">' . __( 'Name' ) . '</label> ' . ( $req ? '<span class="required">*</span>' : '' ) . '<input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . ' /></p>', 'email' => '<p class="comment-form-email"><label for="email">' . __( 'Email' ) . '</label> ' . ( $req ? '<span class="required">*</span>' : '' ) . '<input id="email" name="email" type="text" value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="30"' . $aria_req . ' /></p>', 'url' => '' /** removes website section */, ); return $fields; } add_filter( 'comment_form_default_fields', 'wpfa_remove_comment_website_section' );Ideally, this will be placed in the ‘functions.php’ file of your theme, but better yet this should be included in the Child-Theme you created of the theme you want to modify.