WordPress删除空跨度标签

Noc*_*ebo 5 html wordpress html5

我使用WordPress编辑器,并且想要在“ span”标签中显示一个图标,如下所示:

<div id="question1" class="box-around">
   <div class="box-left"><span class="fa fa-search" aria-hidden="true"> </span></div>
   <div class="box-right">
      <h3>Some Heading</h3>
      Some Text
      <span id="question1-answer"> </span>
    </div>
</div>
Run Code Online (Sandbox Code Playgroud)

每当我在“视觉”中进行更改时,它都会删除“ span”标签,如下所示:

<div id="question1" class="box-around">
  <div class="box-left"></div>
   <div class="box-right">
      <h3>Some Heading</h3>
       Some Text
       <span id="question1-answer"> </span>
    </div>
</div>
Run Code Online (Sandbox Code Playgroud)

奇怪的是,保留了底部的范围(id =“ question1-answer”)。我想念什么吗?我已经尝试在标记内设置空格“&nbsp”,在“ visual”中更改文本并使用不同的标记后,该空格将转换为“”(实际空白)。

谢谢!

Vel*_*Vel 6

将此代码添加到活动主题的functions.php文件中。

function override_mce_options($initArray) {
    $opts = '*[*]';
    $initArray['valid_elements'] = $opts;
    $initArray['extended_valid_elements'] = $opts;
    return $initArray;
} 
add_filter('tiny_mce_before_init', 'override_mce_options');
Run Code Online (Sandbox Code Playgroud)