• Resolved wordcracker

    (@wordcracker)


    I use NicEdit in my WordPress comments system. However, span style does not work. I added the following code to kses.php (under “$allowedtags” section):

    'span' => array(
            'style' => array(),
            'dir' => true,
            'align' => true,
            'lang' => true,
            'xml:lang' => true,
            'class' => array(),
        ),

    It worked well until WordPress was automatically updated to 4.2.3 yesterday. I had edited kses.php file (and span style worked well) but the changes to kses.php disappeared due to the update. I am trying to edit kses.php again but “span style” does not work…

    How can I make it done?

    Thanks for your help.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator Jose Castaneda

    (@jcastaneda)

    THEME COFFEE MONKEY

    Is it this plugin you are using: https://wordpress.org/plugins/wp-nicedit/

    If so, I would highly recommend using a different one as that one hasn’t been updated in over 2 years. One I would try is: https://wordpress.org/plugins/tinymce-comment-field/

    The downside is that if you really want the span to remain styled you will need to make a plugin to filter the $allowedtags so you won’t lose that the next time you update WordPress. It is a quick thing to add and gives you more control as well.

    You can try:

    add_filter( 'wp_kses_allowed_html', 'my_allowed_html', 10, 2 );
    function my_allowed_html( $tags, $context ){
    	$tags['span'] = array(
    			'style' => array(),
    			'dir' => true,
    			'align' => true,
    			'lang' => true,
    			'xml:lang' => true,
    			'class' => array(),
    		);
    	return $tags;
    }
    Thread Starter wordcracker

    (@wordcracker)

    Hi Jose

    Really thanks for your answer and for the code.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Span style not working’ is closed to new replies.