So I have a quote in my page template and I would like to give the user the opportunity to add line breaks whenever they desire to do so.
I wanted the blockquote to have an extra
<p> tag inside the
<blockquote> tag so I could style it better.
The problem I'm having now is that the
<br /> tags are being removed. While using the
wpautop() function they should stay.
Here is what I did:
$matched = preg_match("~(?<=<blockquote>)([\s\S]+?)(?=</blockquote>)~",
$child->post_content, $found); // find the quote in the content with regEx
$found = current($found);
$replace = "<blockquote><p>".$found."</p></blockquote>";// add the <p> tag
$newphrase = str_replace($found, $replace, $found);
$clearQuote = preg_replace("~<blockquote>([\s\S]+?)</blockquote>~", '',
wpautop($child->post_content, true)); // use wpautop to keep the <p> tag
Can anyone see why the
<br> tag is being removed or do I need to add something else?