I have a plugin that inserts code into the_content. I'm using explode('</p>', $content)
in WordPress to break up $content in paragraph blocks. That's great in WP because before inserting the post into the database, WP replaces the newlines with paragraph tags.
However, WP mu doesn't do that. The post table still has the newlines instead of the html paragraph tags. What can I use in my explode statement instead of the closing paragraph tag?
Thanks!
WPMU strips all kinds of stuff in posts, so not sure if you can sub something else, as it will probably get stripped.
I'm using an add_filter [add_filter('the_content', 'my_function');] so what I'm doing isn't impacted by what gets stripped. I just can't figure out how to match the returns. I've tried /n/n, \/n\/n, char(10), etc but I'm so far no luck. :-(
cafespain
Member
Posted 15 years ago #
Make sure that your function is called first if you want to get in before WPMU starts auto formatting the content:
add_filter('the_content', 'my_function', 1);
then
explode("\n", $content);
Make sure you use double quotes. Single quotes will look for the literal value, not the escaped one (newline).
Thanks! The double quotes solved my problem! I'd been using single quotes around the \n.