• Advanced
  • Created On ,
  • Most Recent By Aaron,

DIV id's being stripped out .... any ideas?

We have users (administrators) that have pages that are breaking when they save them. It turns out that DIV ID's are being stripped out when they save, this is happens in visual or html mode and whether or not they switch back and forth from visual to html, it occurs with the visual editor disabled as well. This also occurs with revisions, they are unable to restore older working versions of the page because those too will have the Div's stripped out.

As a super admin this does not occur for me, but when I create a new administrator for an account I can reproduce the error, so it is clearly related to permissions, it does not affect super admins....

Has anyone else experienced this? Anyone have any ideas?

Any feedback appreciated!

    drmike

    Is it happening with just one example of code or many? Can you provide an example of what they're trying to add in along with a link to a post where y we can see what's being stripped?

    One thing that comes to mind is the html tag order being incorrect. For example, something like the following:

    <i><div></i></div>

    I recall wordpress choking on that but it's been a while since that's come up.

    Barry

    Are they using
    id='theid'
    or
    id="theid"

    This is going to sound strange, but i've had a few occasions where the first (single quotes) is stripped, but the second (double quotes) isn't.

    Tracy

    It happens to every DIV ID, every time... it's consistent, unless you're a super admin, then there's no problems. :)

    I can create a page with the following and the ID will be stripped
    <div id="cheese">TEST</div>

    I've tried removing unfiltered-mu for no good reason to see if that might be related to no avail....

    drmike

    Fancy double quotes are getting in what you;re writing maybe? The ones that look like a pair of backticks?

    Oh and what version of wp/wpmu?

    Tracy

    Mike,

    The ones in the example above are double quotes. Single quotes are never used but I just tried and those are stripped out as well....

    drmike

    No, fancy double quotes. Some editors like MS Word, instead of using the normal double quotes that look like the normal lowercase L characters, use what looks like actual quote marks. Like the first two examples here:

    http://zirkel.com/blog/wp-content/uploads/2008/04/picture-20.png

    Wordpress is supposed to either strip those out or replace them with the more web correct two lowercase L marks.

    I;m wondering if this is a bug. You're not copying and pasting this from somewhere, are you?

    Tracy

    I see what you're saying, nope.... I'm just typing directly from my keyboard. :) Wonder if anyone else can reproduce this when they are NOT using a super admin login? That's the confusing thing, I kept trying to reproduce with super admin login to no avail and was like "whuuuuuuuuuut?" and then sure enough, after logging in as normal admin, was able to reproduce error.... even when restoring revisions with ID's, those are stripped.... that's pretty crazy, haven't seen that before. :)

    Barry

    Is this WP3 or an earlier version? Going to see if I can reproduce it locally.

    Tracy

    SORRRRRRRRY. 3.0 ... again, we had to create another user as admin to reproduce, super admin's don't experience the issue.....

    Update: just tried another install and was able to reproduce the issue...

    Aaron

    Hey guys, divs are not on the built in whitelist for allowed tags unless you have the "unfiltered_html" privilege. They are stripped just like script and embeds, and as far as I recall it's always been that way in WPMU.

    What is different is that in WP 3.0 Multisite Superadmins now have the "unfiltered_html" privilege, which in WPMU they didn't. I applaud that change personally.

    If you want to allow the div tag you will have to use our "Additional Tags" plugin. Adjust the array in there appropriately, you don't want to allow everything!

    Aaron

    I meant ids actually. You can see the default array here:
    http://svn.automattic.com/wordpress/trunk/wp-includes/kses.php

    for divs the id attribute is not allowed:

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

    Going back through previos versions that hasn't changed.

    Tracy

    First of all, thanks for your help guys and Aaron, I greatly appreciate your input to clarify this, thank you.

    I totally failed to mention we're using MU Unfiltered.... I removed it to see if it could be the cause thinking ID's were allowed without it and came to the wrong conclusion it wasn't related to the issue when ID's were still stripped out without it....It looks like it was the issue as it doesn't seem to be working in 3.0 (http://wordpress.org/support/topic/413974?replies=3) ....

    We have removed MU Unfiltered and installed Additional Tags and ID's are still stripped out.... Is there anything else we need to add to the Additional Tags plugin to mimic the behavior of MU Unfiltered? Classes are not stripped out, btw and it looks like the plugin is supposed to allow ID's by default based on a quick peak at it, but they aren't being allowed....

    Tracy

    I'm going to open a new thread in Plugins forum regarding Additional Tags plugin, thanks for you help guys!

    Aaron

    Updated with some much needed TLC:

    1.1.0 - 07/13/2010 - Aaron Edwards
    ----------------------------------------------------------------------
    - WP 3.0 compatibility
    - Ability to allow additional tags for supporters only via Super Admin -> Options
    - Removed default adding tags to allowed list for comments. Can be re-enabled via define in plugin header
    - Update Notifications support