Home » Wordpress SEO & Plugins

Fix div tag replacement by p tags in wordpress editor

 March 22, 2008 No Comment

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.

Filed under: Wordpress SEO & Plugins

Leave a Reply