Retaining br tags in posts
Hi all. I’ve searched and found several posts dealing with the reverse issue (too many br tags!). However, I’d like to prevent WP from replacing the br tags in posts with newlines. I tried working backwards through the code but got lost after a while. Anyone know which function is responsible for this?
(And yeah, CSS is the preferred way to deal with spacing, etc. etc., but try telling that to the people for whom I’m building the website!)
If it helps any, this was started and still not resolved.
wpautopis the function that’s doing that. Remove the line that applies it to
/wp-includes/default-filters.phpor use a mini-plugin to
KatGirl: Thanks for the link; I’ll keep an eye on that topic as well.
Viper007Bond: Thank you for the advice. I commented out the line
// add_filter('the_content', 'wpautop');
but unfortunately, the issue persists. Assigning a class to the br tags prevents them from being deleted, but I’m not sure that’s a good long-term solution.
I know there’s a Text Filter plugin which can be used to prevent WordPress from altering the post content coming out of the database; do you know of any which prevent it from altering the content going in?
Is this the one you’re referring to?
Yep, spencerp, that’s the one! That solves half the problem; if only there was an equivalent plugin or hack that prevented the
<br> <p> </p>tags from being stripped before the post is inserted into the database, I could use them both.
Heh, I shoulda known that my friend Jeff woulda made such a plugin.
Will something from this read, work for ya?
- The topic ‘Retaining br tags in posts’ is closed to new replies.