admin管理员组文章数量:1328002
I'm trying to include hyperlinks as part of the description on a category page.
Since WordPress strips the necessary HTML tags, I've added the following PHP code in a plugin, which stops the HTML tags from getting stripped:
add_action('init','disable_kses');
function disable_kses() {
remove_filter('pre_term_description', 'wp_filter_kses');
}
This lets me include HTML tags fine, but when I include a hyperlink in the description, it breaks the page in a weird way, with material from the description being reproduced above the header. This includes all the text from the first hyperlink until the end of the description, but the first link itself isn't reproduced (only the text for it is). In addition, at the very end of the material, the following is appended to the text:
">
So the end result (in terms of the material that appears above the header) looks like this:
Other than that, in the place where the description should appear (under the title), everything renders properly, including the hyperlinks, so that it looks like this:
The HTML that I use to include the hyperlinks is standard:
<a href="/">example</a>
I have also tried similar solutions, such as the "HTML in Category Descriptions" plugin, and the following code, which addresses the other filters that are at play here, but nothing works:
add_action('init','disable_kses');
function disable_kses() {
foreach (array('pre_term_description', 'pre_link_description', 'pre_link_notes', 'pre_user_description') as $filter) {
remove_filter($filter, 'wp_filter_kses');
}
}
My question is what should I be doing differently in order to be able to include hyperlinks as part of the category page description?
本文标签: phpHow to enable HTML tags in category description without breaking the category page
版权声明:本文标题:php - How to enable HTML tags in category description without breaking the category page 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742248298a2440269.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论