Support » Fixing WordPress » WP 2.3 – automatically removes certain tags like DIV

  • zoogies


    What the heck??

    I know a lot of you guys have run into this before: wordpress now doesn’t let you use DIV tags in posts. And why not? What if we do want to throw in a DIV in the content of a post, or say, an object, or something unusual? What is the justification for this? It’s not as if DIVs are dangerous; it simply removes an option for people who want to use them.

    That’s not my main issue though. Yes, I searched and found a solution…however, it worked for wordpress 2.1. Not 2.3…

    In the tinyMCE config file:

    valid_elements : “<?php echo $valid_elements; ?>”,

    Er…so, how do I change the value of $valid_elements?

    Thanks guys 😀 This is kind of irksome. What bothers me most is that if you want to resolve it, you have to dig deep down into core files that will just be replaced on your next update, upon which you’ll have to do some more changing – just so you can use DIV tags? I mean…this isn’t a new issue. Same problems last time, same concerns from users (w.r.t. WP 2.1). I wonder why this isn’t fixed?

    Thanks – and apologies to everyone if I come off as unreasonable or caustic in this post…kind of rushing 😉 I like and enjoy using WP a lot, but this kind of just baffled me.

Viewing 6 replies - 1 through 6 (of 6 total)
  • moshu


    Wysiwyg is NEVER fo inputting code. Period. That’s for the code illiterates.

    You want your code? – don’t use the wysiwyg. Problem solved.
    It’s that simple.


    Thanks for the response and sorry for the delay in getting back.

    The problem is, I’m not in WYSIWIG. Yes, I’m aware that there are two editing panes – ‘Visual’ and ‘Code.’ I know that WYSIWIG isn’t for inputting code; I work exclusively in ‘Code.’

    I should mention that other code seems to work. img. em. strong. you name it. It’s like there’s a stigma against DIV in particular. I’ll use em, for instance. I get italics. img. I get an image. div. I get the div tag, complete with the angle brackets on each site, and the text in between…

    It’s very strange.

    If you read the docs you could read to alter the
    tiny_mce_config.php file





    ‘-‘ means remove empty elements
    ‘p/div’ means replace div by p
    ‘[*]’ means any attribute allowed

    why does wp even replace some tags? is there a way to completely turn off tag-replacement?

    it does it to prevent bad coding.

    Thanks all, for this info. Sounds like perhaps an options menu is needed that would set the WYSIWYG editor’s adherence to coding standards, like the security zones on MS Explorer. You could set it to be more “layman, blogger” friendly, or set it to “crazy coders” to let it accept special tags (whether you code it well or not!).

    And no, I’m not in the market to make it. Just noticing.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘WP 2.3 – automatically removes certain tags like DIV’ is closed to new replies.