Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter madivad

    (@madivad)

    I thought I would add, I only want to change the $allowedtags content, where is the best place to do this? Can I add it to my theme’s functions.php file somewhere? and how exactly would I do that?

    Thread Starter madivad

    (@madivad)

    I have done some experimenting, and after adding the following code to my own theme’s functions.php file, it works perfectly as required. Commenters are now only able to bold and italicise there comments. I tried inserting <a href> tag and it was stripped….

    Now I just want to remove raw links, ie links that people enter by just entering the url without any tags what-so-ever…

    eg, http://google.com still get’s rendered in the comment and is even clickable. I want to totally not even have it.

    I’m thinking of searching through the comment and finding any reference to http: and then just deleting everything from there up to the first space…

    I’m now open to ideas on how to achieve that.

    Oh, and the code I put in my functions.php file:

    $allowedtags = array(
    		'b' => array(),
    		'em' => array (), 'i' => array (),
    	);

    Is there a better place for it?

    popper

    (@julialasarte)

    You want to remove the links completely, or just disable the wordpress filter that makes them clickable automatically?

    To disable auto-links:

    remove_filter('comment_text', 'make_clickable', 9);

    To delete them completely, probably the best idea would be to add a filter to the comment_text pre save or pre display, and delete them using a regular expression. You should be able to find several examples of regex to detect urls easily on google.

    Thread Starter madivad

    (@madivad)

    remove completely… I’ll implement that filter removal for the time being, but I’ll work on your second part and post back my results. Thanks for your input

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘editing kses.php file’ is closed to new replies.