Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Brady Vercher

    (@bradyvercher)

    The content of the textarea is passed through wp_kses_data(), which strips out any HTML that isn’t whitelisted in the $allowedtags global variable for security purposes. I believe you can filter which tags are allowed using the wp_kses_allowed_html filter if you want to add more tags.

    Could you offer an example how to do that within the widget? Or is that something that needs to be edited elsewhere?

    Thanks!

    Plugin Author Brady Vercher

    (@bradyvercher)

    You wouldn’t want to edit the widget code directly since changes will get wiped out when the plugin is updated in the future, but you can add a snippet to your child theme or create a custom plugin of your own. The snippet to whitelist various HTML elements and attributes would look something like this:

    function prefix_allowed_html( $allowedtags, $context ) {
    	$allowedtags['br']   = array();
    	$allowedtags['li']   = array();
    	$allowedtags['ol']   = array( 'start' => true, 'type' => true );
    	$allowedtags['span'] = array( 'align' => true );
    	$allowedtags['ul']   = array( 'type' => true );
    
    	return $allowedtags;
    }
    add_filter( 'wp_kses_allowed_html', 'prefix_allowed_html', 10, 2);
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘HTML in the text area’ is closed to new replies.