Wordpress blockquote removes `<br>` tag
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)~",
wpautop($child-post_content), $found); // find the quote in the content with regEx
$found = current($found);
$replace = "blockquotep".$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?
I came to realize that I don't think it has something to do with the wpautop()
function.
The variable I use it in is used to filter it out of the_content()
.
So $clearQuote
uses the found quote and deletes it from the_content()
where $quoteFound
uses the found value and doesn't use wpautop()
.
So it must be something else.
I added the wpautop()
function to the $matched
variable so it would add a p
tag to where the user break the line. This way there isn't really a line break but the output is the same.
Topic line-breaks wp-autop php Wordpress
Category Web