• I am well aware of the WordPress editor filter that either adds HTML tags or strips others and this has been part of WordPress for years.

    Until a person becomes a web designer and Website developer, this is not really an issue, but for us designers/developers, its a real pain in the ”.

    I have searched the Internet for fixes, to stop WordPress from stripping out DIV tags and HTML Comment tags <!– –>.

    To address the DIV tag stripping, I am using the following fix I found,

    /** STOP WORDPRESS REMOVING DIV TAGS AND RELATED HTML ELEMENTS*/
    // stop wp removing div tags
    function override_tinymce_option($initArray) {
        $opts = '*[*]';
        $initArray['valid_elements'] = $opts;
        $initArray['extended_valid_elements'] = $opts;
        return $initArray;
    }
    add_filter('tiny_mce_before_init', 'override_tinymce_option');

    Unfortunately, it does not work all the time. Every so often it strips out my page navigation tags <div id=”namehere”></div> and I have to replace them.

    For the HTML comment tags, I could not locate anything to fix that. I keep loosing the comment tags.

    I use comment tags to identify blocks of HTML code, because there is a lot of it, so I can find things when I have to go into the text editor.

    There are no plugins to fix this.

    I am hoping a WordPress developer can answer this, – how can I stop WordPress from stripping out my DIV tags and HTML comment tags?

    Thanks

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Need to Stop the Stripping of DIV Tags and HTML Comment Tags’ is closed to new replies.