Disable Automatic Formatting

Add to functions.php file

remove_filter('the_content', 'wptexturize');
remove_filter('the_excerpt', 'wptexturize');
remove_filter('comment_text', 'wptexturize');
remove_filter('the_title', 'wptexturize');

the wptexturize function is responsible for lots of automatic alterations to text stored in WordPress like automatic elipses (...), em and en dashes, typographers quotes, etc.

Comments

  1. User Avatar
    Scott Rod
    Permalink to comment#

    Is there a solution for just removing paragraph tags wrapped around images?
    Regardless, if you’re a developer or writer, those automatically generated paragraphs wrapped around images tend to break a layout and add unnecessary markup.
    Personally, I’ve had to wrap images inside divs, but that still defeats the purpose of excess markup. Plus, the average writer using the visual editing mode is not going to understand how to wrap images inside divs without specific instructions.

  2. User Avatar
    Matt Dunlap

    I know this is a little late, but to remove the auto paragraphs, replace wptexturize with wpautop in the above code snippet

  3. User Avatar
    Toni
    Permalink to comment#

    Hi guys,

    I know THIS post is a bit late, but I just wanted to say this technique doesn’t seem to work for me in WordPress 3.

    Do you have any suggestions? Ideas?

    Thanks.

  4. User Avatar
    KF
    Permalink to comment#

    How can I do the same thing for a custom field?
    I have:

    get_post_meta($post->ID, ‘gallery’, $single = true));

  5. User Avatar
    zzap
    Permalink to comment#

    This one works great with cleaning up nested shortcodes, on latest WordPress version (3.4.1 at the moment):

    Stack Overflow

  6. User Avatar
    Guest
    Permalink to comment#

    I put – remove_filter(‘the_content’, ‘wpautop’); – in my theme’s functions.php file, but nothing happened. It’s still automatically adding paragraphs. I’m using WordPress 3.5.1. Please advise. Thanks!

Submit a Comment

Posting Code

You may write comments in Markdown. This makes code easy to post, as you can write inline code like `<div>this</div>` or multiline blocks of code in triple backtick fences (```) with double new lines before and after.

Code of Conduct

Absolutely anyone is welcome to submit a comment here. But not all comments will be posted. Think of it like writing a letter to the editor. All submitted comments will be read, but not all published. Published comments will be on-topic, helpful, and further the discussion or debate.

Want to tell us something privately?

Feel free to use our contact form. That's a great place to let us know about typos or anything off-topic.

icon-closeicon-emailicon-linkicon-logo-staricon-menuicon-searchicon-staricon-tag