之前在Wordpress+Feedsky的Bug中谈到Wordpress的RSS输出有一个Bug。
错误在于每篇Post的下面这个属性:
<guid isPermaLink="false">http://finance.earlzhang.com/uncategorized/53/</guid>
本来这里应该输出的正确地址是http://finance.earlzhang.com/news-digest/53/
查看了一下Wordpress里面的wp-rss2.php文件,输出的具体代码如下:
<item>
<title><?php the_title_rss() ?></title>
<link><?php permalink_single_rss() ?></link>
<comments><?php comments_link(); ?></comments>
<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false); ?></pubDate>
<dc:creator><?php the_author() ?></dc:creator>
<?php the_category_rss() ?><guid isPermaLink="false"><?php the_guid(); ?></guid>
我对PHP无甚了解,虽然知道问题肯定出在<?php the_guid(); ?>这个函数里面,但我肯定是没有能力解决的。好在还是有变通方法的,把上面输出Link的函数复制放在这里,就暂时解决问题了。现在的代码如下:
<item>
<title><?php the_title_rss() ?></title>
<link><?php permalink_single_rss() ?></link>
<comments><?php comments_link(); ?></comments>
<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false); ?></pubDate>
<dc:creator><?php the_author() ?></dc:creator>
<?php the_category_rss() ?><guid isPermaLink="false"><?php permalink_single_rss() ?></guid>
当然,这个只是权宜之计。还有赖哪位高手,研究一下the_guid()这个函数到底有什么Bug,竟然会输出一个错误的链接地址。
If you liked my post, feel free to subscribe to my rss feeds

BlogoSquare