Fix div tag replacement by p tags in wordpress editor

By Rajesh on March 22, 2008 Filed Under: Wordpress SEO & Plugins

Div tags are replaced into p tags by the WordPress editor.But now there is a solution to fix this WordPress editor problem.

How to use div tags in wordpress editor?

  • Find the file wp-includes/js/tinymce/tiny_mce_config.php in your wordpress setup.
  • Find the line:

    $valid_elements=‘p/-div[*],-strong/-b[*],-em/-i[*],-font[*],-ul[*],-ol[*],-li[*],*[*]‘;
    and Change it to:
    $valid_elements=‘#p[*],-div[*],-strong/-b[*],-em/-i[*],-font[*],-ul[*],-ol[*],
    -li[*],*[*]‘
    ;

The above change lets you use <div> tags in wordpress blog posts and they will not be replaced by <p> tags.This would mean that you can embed code in your WordPress editor, without breaking your whole blog’s layout.

People who read this also viewed these Videos

Loading…

Leave a Reply

Go to Top