WordPress Posting Issue Using “Div”-Tags
Whenever I was using a <div>-tag in a post within the richt text editor of WordPress (i.e. for showing php code as in this post), it was replaced by a <p>-tag which was not what I wanted.
Then I stumbled across this fix on the WordPress support forum to correct this odd behaviour - and it works fine so far!
CAVE:
The fix described in that post requires to manually change the core WordPress files, so you’d better know what you are doing!
[Update from 2008-03-29]
Here is another fix that I found recently as I upgraded my WP installation to the newest version (haven’t tested this fix yet):
1. Open the file called tiny_mce.js located in the wp-includes\js\tinymce folder
2. Goto line 130 - look for this: this._def(”extended_valid_elements”, “”);
3. Change it to this: this._def(”extended_valid_elements”, “div[id|class]“);
Thanks to Scott Bernardot who described this in a comment on urbangiraffe.com and to “richarduk” who linked there in a post on the wordpress.org-forum.
[Update from 2008-06-05]
I found out that some strange spam sites were linking to this post, and there was a lot of uncommon traffic hitting this post - so I decided to change the URL… sorry if you did not find this post at once.
Next post: My Own Customized WP Theme Progress - Part II
Previous post: Display Recent Posts And Comments
Trackback URI | Comments RSS | Permalink




Comment
#1
Mate thanks for this fix. Oh and i like your spam protection where you have to add the numbers! That’s cool I just hope I get it right.