• Resolved Devtard

    (@devtard)


    This code removes almost all allowed_tags in comments:

    define('CUSTOM_TAGS', true);
    global $allowedtags;
    
    $allowedtags = array(
    
    );

    This is what is displayed under the comment form (regardless of the theme I use):

    You may use these HTML tags and attributes: <pre class="" title="" data-url=""> <span class="" title="" data-url=""> <code class="" title="" data-url="">

    Any idea how to disable these tags?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Moderator bcworkz

    (@bcworkz)

    You could just hide the content with CSS. To actually get rid of it, where ever your theme makes a call to comment_form(), you need to supply an argument to override the default for the ‘comment_notes_after’ argument. (What you are seeing is the default value)

    Thread Starter Devtard

    (@devtard)

    Right, but these approaches just remove the text, but not the functionality of the tags.

    Any idea how to really get rid of the tags I mentioned in the first post?

    Moderator bcworkz

    (@bcworkz)

    You already functionally got rid of any allowed tags by emptying the $allowedtags array. The text you see after the form is inconsequential, it has nothing to do with anything now, which is why I thought simply hiding the text might be adequate. As mentioned, to really get rid of the text, supply an empty string as the comment_notes_after argument:
    comment_form(array('comment_notes_after' => ''));

    Or if you like, change it to ‘No HTML allowed.’ or anything else you like.

    Thread Starter Devtard

    (@devtard)

    Well, I’ll probably have to hide the text as you suggested (which is an ugly workaround), because there doesn’t seem to be any feature that would disable the functionality of these remaining tags.

    But I’ll post a new suggestion in the Ideas section, hopefully it will be fixed in the future.

    as those tags are not WordPress defaults, they could be from a plugin;

    try to deactivate all plugins to see if that removes the last tags; then reactivate one plugin at a time to locate the interfering one.

    Thread Starter Devtard

    (@devtard)

    You are right, deactivating all plugins should have been the first step, sorry for wasting your time.

    If anyone else encounters this issue and happens to have the plugin “Crayon Syntax Highlighter” installed, that’s where you’ll find the problem.

    But there still should be a way to remove the tags by emptying all array elements in the variable $allowedtags. It doesn’t work for the externally added tags which use the same variable, and that is strange.

    It doesn’t work for the externally added tags which use the same variable, and that is strange.

    might be a priority issue – the plugins might be executed after your code;

    where is your code located?

    Thread Starter Devtard

    (@devtard)

    Yes, you are right again. The priority of the other plugin’s hook responsible for adding tags was 11, mine hook had the default priority (10). Now it finally works the way I want, thanks.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Some allowed_tags can't be changed’ is closed to new replies.