WordPress editor removes div tags

How to fix:

Option 1: Disable WYSIWYG editor for user

In WordPress admin panel, go to “Users” tab and uncheck “Use the visual editor when writing” box.

Option 2: go inside the code and fix it

Find file wp-includes/js/tinymce/tiny_mce_config.php and change this line:

$valid_elements = 'p/-div[*],-strong/-b[*],-em/-i[*],-font[*],-ul[*],-ol[*],-li[*],*[*]';

to this:

$valid_elements = '-strong/-b[*],-em/-i[*],-font[*],-ul[*],-ol[*],-li[*],*[*]';

EDIT: Apparently it doesn’t work for version 2.3.x, so here’s the fix for that:





Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s