简体   繁体   English

如何删除自动生成 <p> 来自之前生成的WordPress编辑器的标记 <iframe> 标签

[英]How remove auto generated <p> tag from WordPress editor that generate before <iframe> tag

Hello I convert a html template to WordPress theme, I use custom field plugin plugin to do this, but whean i try to lode map that in tag the the out put give as like 您好我将一个html模板转换为WordPress主题,我使用自定义字段插件插件来做到这一点,但是我试图将标签中的lode地图放在外面给出像

. how i remove this p tag that automatically generate. 我如何删除自动生成的p标签。

I used following code in functions.php but not fixed 我在functions.php中使用了以下代码,但没有修复

 <?php remove_filter('term_description','wpautop'); remove_filter( 'the_content', 'wpautop' ); remove_filter( 'the_excerpt', 'wpautop' ); ?> 

You can use Toggle wpautop plugin for that. 你可以使用Toggle wpautop插件。

This may be very helpful for you. 这可能对你很有帮助。 Thanks 谢谢

1.Login to WordPress Dashboard 2.Go to Appearance > Editor 3.Select Theme Functions (functions.php) file. 1.登录WordPress仪表板2.转到外观>编辑器3.选择主题功能(functions.php)文件。 4.Add the following function and click update changes. 4.添加以下功能并单击更新更改。

// Remove P Tags Around Images function filter_ptags_on_images($content) {return preg_replace('/<p>\\s*(<a .*>)?\\s*(<img .* \\/>)\\s*(<\\/a>)?\\s*<\\/p>/iU', '\\1\\2\\3', $content);} add_filter('the_content', 'filter_ptags_on_images'); //删除图像周围的P标签功能filter_ptags_on_images($ content) {return preg_replace('/<p>\\s*(<a .*>)?\\s*(<img .* \\/>)\\s*(<\\/a>)?\\s*<\\/p>/iU', '\\1\\2\\3', $content);} add_filter('the_content', 'filter_ptags_on_images');

That's all. 就这样。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM