首页 > 新闻资讯 > 如何不让WordPress在媒体文件链接周围添加代码

如何不让WordPress在媒体文件链接周围添加代码

0条评论
标签:
更多

当你往WordPress上传MP3,flv等媒体文件时,WordPress会自动在RSS里,给媒体文件链接周围添加一堆默认的包裹代码,以便让媒体文件能在RSS中更好的显示。虽然这是好意,但这个功能在大多数情况下是画蛇添足的。

想要删除默认的包围代码,只需在functios.php中添加如下代码:

function delete_enclosure(){
    return '';
}
add_filter( 'get_enclosed', 'delete_enclosure' );
add_filter( 'rss_enclosure', 'delete_enclosure' );
add_filter( 'atom_enclosure', 'delete_enclosure' );

大功告成!

* 版权声明:作者WordPress啦! 转载请注明出处。

发表新评论

此内容将保密,不会被其他人看见。
  • 自动将网址与电子邮件地址转变为链接。
  • 允许HTML标签:<a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • 自动断行和分段。

更多关於格式化选项的信息

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.