wordpress - 围绕块元素进行锚链接时的Wordpress奇怪行为
问题描述
在 wordpress html 编辑器中,我添加
<a href="/s/toto"><div><img src="/wp-content/uploads/toto.jpg" width="4" height="4"><h2>toto</h2></div></a>
保存时,它变成(最后创建空链接):
<a href="/s/toto">
<div><img src="/wp-content/uploads/toto.jpg" width="4" height="4">
<h2>toto</h2>
</div>
</a><a href="/s/toto"></a>
我尝试过的但在我的情况下不起作用:添加functions.php
remove_filter( 'the_content', 'wpautop' ); remove_filter( 'the_excerpt', 'wpautop' );
或者
add_filter('tiny_mce_before_init', 'modify_valid_children', 99);
function modify_valid_children($settings){
$settings['valid_children']="+a[div|p|ul|ol|li|h1|span|h2|h3|h4|h5|h5|h6]";
return $settings;
}
解决方案
推荐阅读
- python-3.x - 如何使用 Starlette 框架处理 JSON 请求正文
- excel - VBA 中的 SumIf(以变量为条件)
- dart - 如何使用flutter和firestore在google登录期间获取用户displayName的第一个字母?
- python - 在编写 JSON 时防止循环循环的 pythonic 方法是什么?
- c++ - 带线程的 setCursorPosition()
- r - 在反应值消失之前存储它
- c++ - 两个进程之间的共享映射内存在编辑时没有更新
- r - 管道,将数字转换为因子,保留未观察到的水平
- python - 将word文档(Google Docs)的文件夹转换为python可用的句子列表,由reddit bot的换行符分隔?(Perl?)
- jquery - 使用具有多种日期格式的 jQuery Datepicker,但始终使用 val() 以 ISO8601 格式获取/设置