WordPress.org

Ready to get started?Download WordPress

Forums

Remove opening and closing paragraph when applying "the_content" filter (3 posts)

  1. Andrés Sanhueza
    Member
    Posted 4 years ago #

    I have a custom snippet that I want to support all the filters added to the_content—like shortcodes, wptexturize and the like, so I do this:

    $template = apply_filters('the_content', $template);

    The problem is that it causes a <p> and a </p> at the end of the snippet when used inline, probably caused by the wpautop function. How can I still apply "the_content" filters, while escaping the added paragraphs?

    Another option is to add specifics filters manually, but many of those are added by other plugins so I may not keep track of them.

  2. pironic
    Member
    Posted 4 years ago #

    i too would love to know how to do this... anyone know?

  3. oriadam
    Member
    Posted 3 years ago #

    did you try
    remove_filter('the_content','wpautop')
    just before your line of code?

Topic Closed

This topic has been closed to new replies.

About this Topic