I have a Wordpress site and I want to remove the block quotes from the post and put just the regular text. (also want to remove any images that are in the text, I just want the regular text)
This code does the OPPOSITE of what I want - takes out the block quotes and posts that. I want it to post the other text and NOT the block quote.
<?php
// get the content
$block = get_the_content();
// check and retrieve blockquote
if(preg_match('~<blockquote>([\s\S]+?)</blockquote>~', $block, $matches))
// output blockquote
echo $matches[1];
?>
Highlight the text you would like to make a blockquote. If you are not in the text tab, switch to it. Click on the “b-quote” button and your highlighted text will be made a blockquote. The default blockquote is very basic and will simply center the quote.
Type the text that you want to appear in the blockquote section of the post. In the post editor, the quoted text is indented. Press "Enter" to move to a new paragraph after typing the text.
Edit the page, click on the separator block, and select a color under the block Color Settings.
What you need is a content filter. Add the following to your functions.php file
add_filter( 'the_content', 'rm_quotes_and_images' );
function rm_quotes_and_images($content)
{
$content = preg_replace("~<blockquote>([\s\S]+?)</blockquote>~", "", $content);
$content = preg_replace("/<img[^>]+>/i", "", $content);
return $content;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With