[wp-hackers] What does the last line in the wpautop function do?

Glenn Ansley glenn at glennansley.com
Thu Sep 18 01:21:45 GMT 2008


Hi,
I have a single post that isn't making it through the wpautop filter ( all
the others do ).
I can remove the filter and the post prints without formatting.

I've gone into the wpautop function itself for testing and found that the
problem is in the last line that runs preg_replace.

If I die( $pee ); directly before the last preg_replace I get the post
content as expected.
If I die( $pee ); directly after the last preg_replace I get nothing at all
( $pee is empty ).

I need to find out what about this individual post in relation to the final
line of wpautop is not jiving correctly. Unfortunately, I don't have any
bragging rights in the regex arena (I can tell it has to do with shortags).
Could anyone help me understand what this line is doing so that I might
better troubleshoot why the post isn't making it through (length,
characters, etc).

Thanks.

Final Replacement line in wpautop:
$pee = preg_replace('/<p>\s*?(' . get_shortcode_regex() . ')\s*<\/p>/s',
'$1', $pee); // don't auto-p wrap shortcodes that stand alone


More information about the wp-hackers mailing list