Forums

[Solved] Allowed tags underneath comment form (7 posts)

  1. arbiboy
    Member
    Posted 1 year ago #

    Hello my fellow WP users!

    I have some great news (for some of us)!

    I finally found out how to remove the "You may use these tags in your comments" message.

    So I was just staring at the screen trying to find the tags in the kses file but when I went back to my page, I noticed a line saying

    <p class="<strong>form-allowed-tags</strong>">Blah blah blah about tags</p>

    So I went and downloaded ALL of the files not the folders, just the files in the "wp-includes" folder. I used Notepad++ to "Search in files.." for the line "form-allowed-tags" and it turns out that this thing was hidden in a file called "comment-template.php"!!

    So heres what you do:

    1. (Recommended) Get this software for free =====> Notepad++

    2. Go to your directory and download the "comment-template.php" file. <!--- Make sure do back it up into another folder first ---!>

    3. Open it with Notepad++ and go to line 1512.

    4.Now delete everything between the two >'<s (inverted commas) and replace it with this:
    <p><br><br><br></p><p><br><br></p>

    I know it looks messy but hey, it works for me. At least it does the job. If you have a better looking line that will "Add spaces" instead of it losing its foot, please post here.

    4.Now save it and re-upload! :D

    5.Refresh the page and it should be gone...notice the SHOULD.

    Note: This may or may not work for you if you have any problems please post it. I can try to figure it out.

    Thanks for reading my post! I hope this is of good use.
    Arbs.

  2. esmi
    Theme Diva & Forum Moderator
    Posted 1 year ago #

    I wouldn't recommend this solution personally. For a start, it's never a good idea to edit the core WP files unless you really, really, know what you're doing. Secondly, assuming you are successful, your changes will be over-written the next time you upgrade WordPress.

    You can amend the comment form output - including the "allowed tags" block - using the args parameter in comment_form on a per-theme basis.

  3. arbiboy
    Member
    Posted 1 year ago #

    I know...but this thing has gotten me for a long time and its like I can die happy now that its gone! xD I have tried EVERYTHING that has been instructed but still no provail. I think its because I have a different template. Do you think there are other people that are experiencing the same things? If you dont should I take this post off?

  4. esmi
    Theme Diva & Forum Moderator
    Posted 1 year ago #

    I have tried EVERYTHING that has been instructed but still no provail

    You obviously hadn't tried some of my themes. :-) I'm now starting to add an option to remove the allowed tags on the final comment form display to many of my themes.

    In theory, to remove it completely on a per theme basis, you should only need to add:

    function my_comment_form_args($user_identity, $post_id, $req) {
    	$args = array(
    		'comment_notes_after' => ''
    	);
    	return $args;
    }

    to your theme's functions.php

    and then use <?php comment_form( my_comment_form_args($user_identity, $post->ID, $req) ); ?> in your theme's comments.php template file. I say "in theory" because that's a very cut-down version of what I use in themes.

    Do you think there are other people that are experiencing the same things?

    I do think that on many sites, the allowed tags are probably unnecessary and may seem downright ugly - which is why I'm now adding an option to switch them off in my themes.

    And I don't think your post should be removed. There is always more than 1 solution to most problems. I just think that people should be aware of the potential issues when editing core files.

  5. arbiboy
    Member
    Posted 1 year ago #

    Is there some of of thread that will let people talk about how they got rid of it?

    Btw, that code looks good. I have never seen that before, I think i might try it. Oh and do you think I should put some sort of "Danger" sign? like "Do this at your own risk" or "Beware, you may run into several problems" ?

    Thanks.

    Ps. How did you build these templates? By hand? Software? They look great!

  6. esmi
    Theme Diva & Forum Moderator
    Posted 1 year ago #

    Btw, that code looks good. I have never seen that before, I think i might try it.

    Have a look at http://codex.wordpress.org/Function_Reference/comment_form

    There's a whole stack of stuff you can change in the comment form by manipulating the tag parameters and arguments. The Codex page is a bit overwhelming at first but, if you tackle it one bit at a time, you can work through it fairly easily.

    do you think I should put some sort of "Danger" sign? like "Do this at your own risk" or "Beware, you may run into several problems" ?

    Nope. There are plenty of experienced people out there who regularly hack core code. Hopefully this discussion will allow people to see both sides of the coin and then make an informed decision. At the end of that day, I think that's the best we can ask for, yes.? :-)

    How did you build these templates? By hand? Software?

    By hand using TextPad which allows me to create my own clip libraries and macros to take out some of the drudge work.

    They look great!

    Thank you :-) But what you see now has taken quite a while. I'm constantly updating, polishing and generally trying to make them a little bit better.

  7. FarmerSeventy-Seven
    Member
    Posted 1 year ago #

    The following is what I used, it only requires editing the comments.php and it kept the custom styling I already done on my comment form.

    In comments.php, I replaced the last line with:

    $defaults = array(
    	'fields'               => apply_filters( 'comment_form_default_fields', $fields ),
    	'comment_field'        => '<p class="comment-form-comment"><textarea id="comment" name="comment" cols="45" rows="10" aria-required="true"></textarea></p>',
    	'comment_notes_before' => '',
            'comment_notes_after' => ''
    );
    ?>
    
    <?php if ( function_exists( 'comment_form' ) ) comment_form($defaults) ?>

    Doing it like this, I don't have to worry about having to back up the theme function.php if something goes wrong.

Topic Closed

This topic has been closed to new replies.

About this Topic