admin管理员组文章数量:1122846
After reading this and this, I want to remove the title attribute from all links of my blog, as that is good from accessibility point of view. How this can be achieved?
UPDATE
I found a solution how to remove title attribute from images, but it doesn't work for me.
After reading this and this, I want to remove the title attribute from all links of my blog, as that is good from accessibility point of view. How this can be achieved?
UPDATE
I found a solution how to remove title attribute from images, but it doesn't work for me.
Share Improve this question edited Apr 13, 2017 at 12:37 CommunityBot 1 asked Jul 29, 2015 at 21:47 YuriYuri 1,1314 gold badges25 silver badges46 bronze badges 7- The title attribute is fine if used correctly. Why do you think that removing it is "good"? – s_ha_dum Commented Jul 29, 2015 at 22:02
- 1 It can be abused and thus breaking the accessibility. That's why it was removed from the default WP TinyMCE editor. – denis.stoyanov Commented Jul 29, 2015 at 22:09
- @s_ha_dum I updated the question. – Yuri Commented Jul 29, 2015 at 22:12
- @s_ha_dum I know about that solution and it doesn't work for me, I don't know why. – Yuri Commented Jul 29, 2015 at 22:23
- @s_ha_dum ... and that answers are not accepted yet. – Yuri Commented Jul 29, 2015 at 22:27
1 Answer
Reset to default 0Do you want to preserve the images title attribute? If not here is a code that fixes that for you:
add_filter('the_content', 'remove_title_attr');
function remove_title_attr($text) {
// Get all title="..." tags from the html.
$result = array();
preg_match_all('|title="[^"]*"|U', $text, $result);
// Replace all occurances with an empty string.
foreach($result[0] as $html_tag) {
$text = str_replace($html_tag, '', $text);
}
return $text;
}
Found it here. It works on c9.io. I believe it will work in your case, too.
Edit 1: This will remove the title attribute from all your posts' content. Do you want to remove it globally from all elements?
本文标签: customizationRemove all link title attributes
版权声明:本文标题:customization - Remove all link title attributes 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736285832a1927541.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论