首页 > 解决方案 > 自定义字段的插件?

问题描述

这个插件https://wordpress.org/plugins/no-external-links/

我正在使用自定义字段。

<?php $values = get_post_custom_values("imgurl"); echo $values[0]; ?>

该插件不会掩盖我的自定义字段。如何屏蔽此链接?

我应该在函数文件中添加什么代码?谢谢

// You will have to add just a line in a theme code where you output custom field data.
// To add same preprocessing for data as for comment text, use
$metadata = apply_filters(‘comment_text’, $metadata);

// For example, if you use some kind of metadata, it should look like this:
$metadata = get_post_meta($id, ‘MetaTagName’, true); // get data from wordpress database
$metadata = apply_filters(‘comment_text’, $metadata); // add this line of code for preprocessing field value
echo $metadata; //output preprocessed field value

// Use “the_content” instead of “comment_text” if you want to use the same masking policy as for post text. https://www.ozgurbilgi.net

标签: wordpress

解决方案


推荐阅读