禁止 WordPress 添加 <p>标签 [英] Disable WordPress from adding <p> tags

查看:33
本文介绍了禁止 WordPress 添加 <p>标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我所拥有的只是以下一小段代码:

All I've got is the following little snippet of code:

<select size="1" name="EventHour<?php echo $i; ?>"> 
    <option>1</option> 
    <option>2</option> 
    <option>3</option> 
    <option>4</option> 
    <option>5</option> 
    <option>6</option> 
    <option>7</option> 
    <option>8</option> 
    <option>9</option> 
    <option>10</option> 
    <option>11</option> 
    <option>12</option> 
  </select> 
  : <!-- note this character -->
  <select size="1" name="EventMinute<?php echo $i; ?>"> 
    <option>00</option> 
    <option>05</option> 
    <option>10</option> 
    <option>15</option> 
    <option>20</option> 
    <option>25</option> 
    <option>30</option> 
    <option>35</option> 
    <option>40</option> 
    <option>45</option> 
    <option>50</option> 
    <option>55</option> 
  </select> 

应该可以正常输出.但是,WordPress 在我的两个选择元素以及:"字符周围添加了一个 p 标签.这使得它们最终都在不同的行中.

The should output fine. However, WordPress adds a p-tag around both of my select-elements as well as around the ":"-character. This makes them all end up on different rows.

我已经在此页面上安装并激活了 WordPress 插件禁用可视化编辑器所见即所得",但没有成功.我还能做些什么来阻止这种情况发生?提前致谢!

I've installed and activated the WordPress plugin "Disable Visual Editor WYSIWYG" on this page without any success. Any other ideas what I can do to stop this from happening? Thanks in advance!

推荐答案

使用这个:

remove_filter( 'the_content', 'wpautop' );
remove_filter( 'the_excerpt', 'wpautop' );

在你的 functions.php

这是完整的答案:http://codex.wordpress.org/Function_Reference/wpautop#Disabling_the_filter

这篇关于禁止 WordPress 添加 &lt;p&gt;标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆