![](/img/trans.png)
[英]How remove auto generated <p> tag from WordPress editor that generate before <iframe> tag
[英]Bootstrap auto generate <p> tag in Wordpress
因為 the_content() 將始終用<p>
標記包裝內容。
您可以使用 get_the_content() insted of the_content() 但使用 get_the_content() 將為您提供沒有任何短代碼或嵌入媒體的內容,如codex所述。
這是獲得您想要的東西的另一種解決方案:
<?php
$content = get_the_content();
$content = apply_filters('the_content', $content);
$replace = '<p class="discription">';
echo str_replace('<p>', $replace, $content ); ?>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.