WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How do I remove <p> from the_content ? (11 posts)

  1. miealex
    Member
    Posted 7 years ago #

    Every time you post something the_content is shown on your page like this ...

    <p>the_content</p>

    ... even tho you didn't input this into your post.

    How do I remove <p> and </p> from my content? Does anyone know?

    Thanks,
    Alex

  2. miealex
    Member
    Posted 7 years ago #

    Nobody knows? :/

  3. varkenshand
    Member
    Posted 7 years ago #

    Two ways:

    the hard way - comment out the autop filter for content in the default filters file. (wp-includes/default-filters.php)

    The better way: install Text Control plugin. Works great for p's and also for quote misery in code. Adds two buttons to your Admin/ Write page.

  4. miealex
    Member
    Posted 7 years ago #

    If anyone gets to this post I suggest you go here http://mtdewvirus.com/code/wordpress-plugins/ and get the smallest plugin ever created called Disable WPautop. It is the simplest way it can be done.

    Thanks for replying tho varkenshand ;)

  5. waydomatic
    Member
    Posted 7 years ago #

    You could always just replace <?php the_content(); ?> with

    <?php echo $wpdb->get_var("SELECT post_content FROM $wpdb->posts WHERE ID = $id");?>.

  6. prestogifto
    Member
    Posted 7 years ago #

    Thanks for all the suggestions. For the benefit of future users, the waydomatic idea didn't work with the exec-php plugin.

    BUT Disable WPautop works GREAT. Thanks a ton to varkenshand and everyone who gave me input. It was really helpful.

  7. spoonervt
    Member
    Posted 7 years ago #

    or if you go into
    wp-includes/default-filters.php

    you can edit around line: 123
    add_filter('the_content', 'wpautop');

    and just comment that out with //
    //add_filter('the_content', 'wpautop');

    voila! no plug in overhead and no more <P> tags messing up your images

  8. gspark
    Member
    Posted 6 years ago #

    just curious, why would one want to remove the <p> tags in content ? isn't that the way content should be formated ?

    i've never seen content without the use of paragraph tags or am i missing something here

  9. Yeago
    Member
    Posted 6 years ago #

    gspark, you're missing something. =)

    WP inserts Ps in all kinds of places that it just doesn't belong.

  10. Yeago
    Member
    Posted 6 years ago #

  11. daleyboy50
    Member
    Posted 6 years ago #

    well from this discussion board i tried this
    and just comment that out with //
    //add_filter('the_content', 'wpautop');

    then this..
    http://yeago.net/works/problem-issue-with-wordpress-messing-up-html-with-p-and-br-tags

    then this
    http://urbangiraffe.com/plugins/disable-wpautop/

    and still have the problem.. any other suggestions would be appreciated.. one that works with the 2.2 and above?! couple of these are very dated and wordpress has changed since..

Topic Closed

This topic has been closed to new replies.

About this Topic