WordPress.org

Ready to get started?Download WordPress

Forums

WP stripping out my XHTML between HTML and Visual views?! (2 posts)

  1. ldexterldesign
    Member
    Posted 5 years ago #

    yo guys,

    got the following custom tooltip in my code, but whenever i switch from html to visual views in write post manager WP strips out the enpty <span></span> for me, which i don't want to happen:

    FROM
    <a class="tt" href="http://wordpress.org/">WordPress<span class="tooltip"><span class="top"></span><span class="middle">Check out the world famous blogging tool</span><span class="bottom"></span></span></a>

    TO
    <a class="tt" href="http://wordpress.org/">WordPress<span class="tooltip"><span class="middle">Check out the world famous blogging tool</span></span></a>

    have implmented this (http://maisonbisson.com/blog/post/11674/wordpress-strips-classnames-and-how-to-fix-it/) in the kses.php file, but no luck:

    if (!CUSTOM_TAGS) {
    	/**
    	 * Kses global for default allowable HTML tags
    	 *
    	 * Can be override by using CUSTOM_TAGS constant
    	 * @global array $allowedposttags
    	 * @since 2.0.0
    	 */
    	$allowedposttags = array(
    	'top' => array(),
    	'bottom' => array(),
    		'address' => array(),
    		'a' => array(
    			'class' => array (),
    			'href' => array (),
    			'id' => array (),
    			'title' => array (),
    			'rel' => array (),
    			'rev' => array (),
    			'name' => array (),
    			'target' => array()),

    any thoughts guys?

    cheers,
    lewis

  2. pommie
    Member
    Posted 5 years ago #

    Assuming that you are still using the default editor (tiny-mce) you could add the TinyMCE Valid Elements plug in and then define your span class tags in that.

    This html stripping is a royal PITA for teh growing number of us who are trying to use WordPress as a web design tool that allows multiple people to manage content. Yeah OK I know it's not WP's primary purpose but if it wasn't for this irritating problem it would be an absolutely ideal tool.

    As far as I can tell the rationale behind it is to prevent code injection - is that correct. If so would it not be possible to have an editor that doesn't strip code for posts/pages and a BB code editor for comments? Is that a stupid idea? It looks like that's what we are using here after all.

Topic Closed

This topic has been closed to new replies.

About this Topic