我有以下代码,它可以提取blockquote并将我的WordPress帖子内容放入<p>
标签中。从段落标签中删除图片
<?php
$content = preg_replace('/<blockquote>(.*?)<\/blockquote>/', '', get_the_content());
$content = wpautop($content); // Add paragraph-tags
$content = str_replace('<p></p>', '', $content); // remove empty paragraphs
echo $content;
?>
但是它把图像中,我不想
1.你想做什么? 2.你是否尝试自己写点东西? 3.输出是怎样的? – Dekel
您可能需要为图像运行另一个'''preg_replace'''。 [Here](http://wordpress.stackexchange.com/questions/7090/stop-wordpress-wrapping-images-in-a-p-tag)是一个模式的例子。 – CUGreen