[wp-hackers] Issues with wpautop and my plugin
Kimmo Suominen
kimmo+key+wordpress.c4f53f at suominen.com
Thu Aug 3 13:47:50 GMT 2006
You could always remove the wpautop filter and call wpautop from your
own code with the second argument being 0.
remove_filter('the_content', 'wpautop');
add_filter('the_content', 'myfilter', 99);
function myfilter($text)
{
//... do whatever first
wpautop($text, 0);
}
This would skip the part that inserts "<br />" at each newline
character.
Alternatively you could just make sure you don't have newlines in the
wrong places.
Actually, I don't see how
<this><is><some><html>
would be affected (except after the last tag), while
<this>
<is>
<some>
<html>
would be. But I could be reading the lookbehind regexp wrong...
The Markdown plugin has a good list of filters to remove and priorities
for where to add your own filters, if you need to play with wpautop.
I like it how comments get "converted" to HTML before insertion into
the database (while posts and pages are kept in Markdown format).
http://www.michelf.com/projects/php-markdown/
Best regards,
+ Kimmo
--
<A HREF="http://kimmo.suominen.com/">Kimmo Suominen</A>
On Thu, Aug 03, 2006 at 05:17:54AM -0700, Viper007Bond wrote:
> Hmm, I'm doing basically BBCode as the placeholder:
>
> [mytag foo="bar"]blah[/mytag]
>
> If I do 99, the quotes get turned to fancy quotes. Anything I can do
> about that? Or should I just go any search for the fancy quoted version
> of my tag (which shouldn't be hard to do)?
>
> Kimmo Suominen wrote:
> >On Thu, Aug 03, 2006 at 04:57:09AM -0700, Viper007Bond wrote:
> >>I'm adding HTML into a post via a filter.
> >>
> >>Let's say my code is structured like this:
> >>
> >><this><is><some><html>
> >>
> >>The problem is that wpautop is doing basically this:
> >>
> >><p><this><br />
> >><is><br />
> >><some><html>
> >></p>
> >>
> >>How can I stop those line breaks from being added? Should I like use
> >>some regex to get rid of them?
> >
> >Add your filter after wpautop, e.g.
> >
> >add_filter('comment_text', 'myfilter', 99);
> >
> >Best regards,
> >+ Kimmo
More information about the wp-hackers
mailing list