如何防止 Wordpress TinyMCE 剥离没有链接文本的 url [英] How to prevent Wordpress TinyMCE from stripping url having no link text

查看:23
本文介绍了如何防止 Wordpress TinyMCE 剥离没有链接文本的 url的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的 wordpress 网站上使用 TinyMCE 编辑器上的自定义按钮来插入网址列表,而无需输入标记.问题是 TinyMCE 会自动删除没有链接文本的 url.例如,如果自定义按钮被编程为插入

I'm using a custom button on the TinyMCE editor on my wordpress site to insert a list of urls without having to type the markup. The problem is that TinyMCE automatically removes the urls that do not have a link text. For example, if the custom button is programmed to insert

<a href="http://example.com"></a>

好吧,没有插入任何内容.

well, nothing is inserted.

但是如果我让按钮插入

<a href="http://example.com">Example.com</a>

它有效.我不想要链接文本,因为我需要使用背景图片精灵而不是使用 html img 标签的图片链接.

it works. I do not want a link text as I need an image link by using background image sprite instead of by using html img tag.

有什么办法可以防止 tinymce 剥离没有链接文本的链接?

Is there any way I could prevent tinymce stripping links that have no link text?

推荐答案

试试这个:

function myformatTinyMCE($in) {
    $in['verify_html']=false;
    return $in;
}
add_filter('tiny_mce_before_init', 'myformatTinyMCE' );

此选项启用或禁用元素清理功能.如果将此选项设置为 false,则将跳过所有元素清理,但仍会执行其他清理功能,例如 URL 转换.

This option enables or disables the element cleanup functionality. If you set this option to false, all element cleanup will be skipped but other cleanup functionality such as URL conversion will still be executed.

这篇关于如何防止 Wordpress TinyMCE 剥离没有链接文本的 url的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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