{"id":1298,"date":"2009-06-20T00:47:01","date_gmt":"2009-06-19T16:47:01","guid":{"rendered":"https:\/\/www.wopus.org\/?p=1298"},"modified":"2009-06-20T00:47:01","modified_gmt":"2009-06-19T16:47:01","slug":"%e8%ae%a9wp%e4%be%a7%e8%be%b9%e6%a0%8f%e8%af%84%e8%ae%ba%e4%b8%8d%e6%98%be%e7%a4%ba%e8%af%84%e8%ae%ba%e8%80%85%e9%93%be%e6%8e%a5","status":"publish","type":"post","link":"https:\/\/wopus.org\/?p=1298","title":{"rendered":"\u8ba9WP\u4fa7\u8fb9\u680f\u4e0d\u663e\u793a\u8bc4\u8bba\u8005\u94fe\u63a5"},"content":{"rendered":"<p>\u8fd9\u4e24\u5929\u8001\u662f\u6709\u5c0f\u767d\uff0c\u4e00\u4e9b\u60f3\u901a\u8fc7\u4e0d\u6b63\u5f53\u7684 SEO \u6765\u83b7\u53d6\u81ea\u5df1 PR \u7684\u5c0f\u767d\uff0c\u770b\u51c6\u4e86\u6211\u7684\u535a\u5ba2\u548c\u7f51\u7ad9\u7684\u4fa7\u8fb9\u680f\u6700\u65b0\u8bc4\u8bba\u7528\u7684\u662f Widget \uff08\u5c31\u662f WordPress \u9ed8\u8ba4\u7684\uff0c\u81f3\u4e8e\u4e3a\u4ec0\u4e48\u8fd9\u4e48\u7528\uff0c\u662f\u56e0\u4e3a\u53ef\u4ee5\u7528\u4e0a\u7f13\u5b58\u63d2\u4ef6\u800c\u5df2\uff09\uff0c\u5c31\u8dd1\u6765\u7559\u8a00\uff0c\u8bf4\u7684\u4e5f\u6ca1\u5565\uff0c\u65e0\u975e\u662f\u652f\u6301\uff0c\u9876\u4e4b\u7c7b\u7684\uff0c\u7136\u540e\uff0c\u7559\u4e0b\u81ea\u5df1\u7684\u5783\u573e\u7ad9\u7684\u7f51\u5740\u5c31\u8dd1\u4e86\uff0c\u5bf9\u4e8e\u8fd9\u79cd\u4eba\u6e23\uff0c\u4eba\u8089 Spam\uff0c\u6211\u662f\u6700\u8ba8\u538c\u7684\u3002<\/p>\n<p>\u5728 WordPress \u7684\u6587\u7ae0\u548c\u9875\u9762\u4e2d\uff0c\u8bc4\u8bba\u8005\u7684\u94fe\u63a5\u9ed8\u8ba4\u662f no follow \u7684\uff0c\u6240\u4ee5\u5bf9\u81ea\u5df1\u7684 PR \u6beb\u65e0\u7528\u5904\uff0c\u800c Widget \u8c03\u7528\u7684\u6700\u65b0\u8bc4\u8bba\uff0c\u786e\u5b9e\u6ca1\u6709 no follow \uff0c\u8fd9\u6837\u5c31\u8ba9\u4e00\u4e9b\u6295\u673a\u7684\u4eba\u94bb\u4e86\u7a7a\u5b50\uff0c\u4e0d\u505c\u8bc4\u8bba\uff0c\u9664\u4e86\u76f4\u63a5  spam \u4ee5\u5916\uff0c\u80fd\u5426\u901a\u8fc7\u81ea\u5df1\u4fee\u6539\u6587\u4ef6\u6765\u8fbe\u5230\u76ee\u7684\u5462\uff1f\u7b54\u6848\u662f\u80af\u5b9a\u7684\u3002<\/p>\n<p>\u7528\u975e\u8bb0\u4e8b\u672c\u6253\u5f00 wp-includeswidgets.php ( WordPress 2.8 \u4ee5\u524d\u7248\u672c\uff0cWordPress 2.8 \u7684\u8bdd\u662fwp-includesdefault-widgets.php)\u6587\u4ef6\uff0c\u641c\u7d22 get_comment_author_link() \uff0c\u5982\u679c\u4ee5\u524d\u6ca1\u4fee\u6539\u8fc7\uff0c\u5e94\u8be5\u53ea\u6709\u4e00\u4e2a\uff0c\u7136\u540e\u628a get_comment_author_link() \u4fee\u6539\u4e3a get_comment_author() \uff0c\u7136\u540e\u5237\u65b0\u6216\u8005\u5220\u9664\u7f13\u5b58\uff0c\u518d\u770b\u770b\u9996\u9875\uff0c\u6ca1\u6709\u8bc4\u8bba\u8005\u7684\u94fe\u63a5\u4e86\u5427\uff0c\u54ce\uff0c\u5bf9\u4ed8\u4eba\u8089 Spam \uff0c\u53ea\u80fd\u7528\u8fd9\u62db\uff0c\u5047\u5982\u6ca1\u4eba\u4f1a\u53ef\u4ee5\u4e3a\u4e86 PR \u800c\u7559\u8a00\uff0c\u6211\u662f\u5f88\u4e50\u610f\u628a\u6240\u6709\u670b\u53cb\u7684\u7559\u8a00\u90fd\u76f4\u63a5\u653e\u5230\u9996\u9875\uff0c\u800c\u4e14\u7ed9\u4f60\u4e00\u4e2a\u94fe\u63a5\uff0c\u5475\u5475\u3002<\/p>\n<p>\u8bdd\u8bf4\uff0c\u901a\u8fc7\u89c2\u5bdf wp-includeswidgets.php \u6587\u4ef6\uff0c\u4f60\u4f1a\u53d1\u73b0\u5f88\u591a\u6709\u8da3\u7684\u4fa7\u8fb9\u680f\u4e1c\u4e1c\uff0c\u6bd4\u5982\u8fd9\u4e2a\u6700\u65b0\u8bc4\u8bba\u7684\u91cd\u8981\u90e8\u5206\u4ee3\u7801\u662f\uff1a<br \/>\n<code><br \/>\nfunction wp_widget_recent_comments($args) {<br \/>\nglobal $wpdb, $comments, $comment;<br \/>\nextract($args, EXTR_SKIP);<br \/>\n$options = get_option(\u2019widget_recent_comments\u2019);<br \/>\n$title = empty($options['title']) ? __(\u2019Recent Comments\u2019) : apply_filters(\u2019widget_title\u2019, $options['title']);<br \/>\nif ( !$number = (int) $options['number'] )<br \/>\n$number = 5;<br \/>\nelse if ( $number &lt; 1 )<br \/>\n$number = 1;<br \/>\nelse if ( $number &gt; 15 )<br \/>\n$number = 15;<br \/>\nif ( !$comments = wp_cache_get( \u2018recent_comments\u2019, \u2018widget\u2019 ) ) {<br \/>\n$comments = $wpdb-&gt;get_results(\u201dSELECT * FROM $wpdb-&gt;comments WHERE comment_approved = \u20181\u2032 ORDER BY comment_date_gmt DESC LIMIT $number\u201d);<br \/>\nwp_cache_add( \u2018recent_comments\u2019, $comments, \u2018widget\u2019 );<br \/>\n}<br \/>\n?&gt;<\/p>\n<ul id=\"\u201drecentcomments\u201d\">if ( $comments ) : foreach ( (array) $comments as $comment) :<br \/>\necho  \u2018<\/p>\n<li class=\"\u201drecentcomments\u201d\">\u2019 . sprintf(__(\u2019%1$s on %2$s\u2019), get_comment_author_link(), \u2018<a href=\"\u201d\u2018\">comment_ID) ) . \u2018\u201d&gt;\u2019 . get_the_title($comment-&gt;comment_post_ID) . \u2018<\/a>\u2019) . \u2018<\/li>\n<p>\u2019;<br \/>\nendforeach; endif;?&gt;<\/ul>\n<p><\/code><\/p>\n<p>\u600e\u4e48\u6837\uff1f\u4e0d\u559c\u6b22\u7528 widget \u7684\u540c\u5b66\u53ef\u4ee5\u53d1\u6325\u81ea\u5df1\u7684\u806a\u660e\u624d\u667a\uff0c\u5bfc\u5165\u5230\u4e3b\u9898\u7684 siderbar.php \u91cc\uff0c\u90a3\u5c31\u53ef\u4ee5\u5b9e\u73b0\u4e0d\u4f9d\u9760\u4efb\u4f55\u63d2\u4ef6\u6216\u8005 widget \u5c31\u80fd\u663e\u793a\u6700\u65b0\u8bc4\u8bba\u4e86\u3002<\/p>\n<p>\u4e0d\u8fc7\u6211\u8fd8\u662f\u63a8\u8350\u4f7f\u7528 widget \uff0c\u56e0\u4e3a\u53ef\u4ee5\u914d\u5408 WP Widget Cache \u63d2\u4ef6\u6765\u7f13\u5b58\uff0c\u55ef\uff0c\u9002\u5408\u5c0f\u6d41\u91cf\u7684\u535a\u5ba2\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8fd9\u4e24\u5929\u8001\u662f\u6709\u5c0f\u767d\uff0c\u4e00\u4e9b\u60f3\u901a\u8fc7\u4e0d\u6b63\u5f53\u7684 SEO \u6765\u83b7\u53d6\u81ea\u5df1 PR \u7684\u5c0f\u767d\uff0c\u770b\u51c6\u4e86\u6211\u7684\u535a\u5ba2\u548c\u7f51\u7ad9\u7684\u4fa7\u8fb9\u680f\u6700\u65b0\u8bc4\u8bba\u7528\u7684\u662f Widget \uff08\u5c31\u662f WordPress \u9ed8\u8ba4\u7684\uff0c\u81f3\u4e8e\u4e3a\u4ec0\u4e48\u8fd9\u4e48\u7528\uff0c\u662f\u56e0\u4e3a\u53ef\u4ee5\u7528\u4e0a\u7f13\u5b58\u63d2\u4ef6\u800c\u5df2\uff09\uff0c\u5c31\u8dd1\u6765\u7559\u8a00\uff0c\u8bf4\u7684\u4e5f\u6ca1\u5565\uff0c\u65e0\u975e\u662f\u652f\u6301\uff0c\u9876\u4e4b\u7c7b\u7684\uff0c\u7136\u540e\uff0c\u7559\u4e0b\u81ea\u5df1\u7684\u5783\u573e\u7ad9\u7684\u7f51\u5740\u5c31\u8dd1\u4e86\uff0c\u5bf9\u4e8e\u8fd9\u79cd\u4eba\u6e23\uff0c\u4eba\u8089 Spam\uff0c\u6211\u662f\u6700\u8ba8\u538c\u7684\u3002 \u5728 WordPress \u7684\u6587\u7ae0\u548c\u9875\u9762\u4e2d\uff0c\u8bc4\u8bba\u8005\u7684\u94fe\u63a5\u9ed8\u8ba4\u662f no follow \u7684\uff0c\u6240\u4ee5\u5bf9\u81ea\u5df1\u7684 PR \u6beb\u65e0\u7528\u5904\uff0c\u800c Widget \u8c03\u7528\u7684\u6700\u65b0\u8bc4\u8bba\uff0c\u786e\u5b9e\u6ca1\u6709 no follow \uff0c\u8fd9\u6837\u5c31\u8ba9\u4e00\u4e9b\u6295\u673a\u7684\u4eba\u94bb\u4e86\u7a7a\u5b50\uff0c\u4e0d\u505c\u8bc4\u8bba\uff0c\u9664\u4e86\u76f4\u63a5 spam \u4ee5\u5916\uff0c\u80fd\u5426\u901a\u8fc7\u81ea\u5df1\u4fee\u6539\u6587\u4ef6\u6765\u8fbe\u5230\u76ee\u7684\u5462\uff1f\u7b54\u6848\u662f\u80af\u5b9a\u7684\u3002 \u7528\u975e\u8bb0\u4e8b\u672c\u6253\u5f00 wp-includeswidgets.php ( WordPress 2.8 \u4ee5\u524d\u7248\u672c\uff0cWordPress 2.8 \u7684\u8bdd\u662fwp-includesdefault-widgets.php)\u6587\u4ef6\uff0c\u641c\u7d22 get_comment_author_link() \uff0c\u5982\u679c\u4ee5\u524d\u6ca1\u4fee\u6539\u8fc7\uff0c\u5e94\u8be5\u53ea\u6709\u4e00\u4e2a\uff0c\u7136\u540e\u628a get_comment_author_link() \u4fee\u6539\u4e3a get_comment_author() \uff0c\u7136\u540e\u5237\u65b0\u6216\u8005\u5220\u9664\u7f13\u5b58\uff0c\u518d\u770b\u770b\u9996\u9875\uff0c\u6ca1\u6709\u8bc4\u8bba\u8005\u7684\u94fe\u63a5\u4e86\u5427\uff0c\u54ce\uff0c\u5bf9\u4ed8\u4eba\u8089 Spam \uff0c\u53ea\u80fd\u7528\u8fd9\u62db\uff0c\u5047\u5982\u6ca1\u4eba\u4f1a\u53ef\u4ee5\u4e3a\u4e86 PR \u800c\u7559\u8a00\uff0c\u6211\u662f\u5f88\u4e50\u610f\u628a\u6240\u6709\u670b\u53cb\u7684\u7559\u8a00\u90fd\u76f4\u63a5\u653e\u5230\u9996\u9875\uff0c\u800c\u4e14\u7ed9\u4f60\u4e00\u4e2a\u94fe\u63a5\uff0c\u5475\u5475\u3002 \u8bdd\u8bf4\uff0c\u901a\u8fc7\u89c2\u5bdf wp-includeswidgets.php \u6587\u4ef6\uff0c\u4f60\u4f1a\u53d1\u73b0\u5f88\u591a\u6709\u8da3\u7684\u4fa7\u8fb9\u680f\u4e1c\u4e1c\uff0c\u6bd4\u5982\u8fd9\u4e2a\u6700\u65b0\u8bc4\u8bba\u7684\u91cd\u8981\u90e8\u5206\u4ee3\u7801\u662f\uff1a function wp_widget_recent_comments($args) { global $wpdb, $comments, $comment; extract($args, EXTR_SKIP); [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[25],"tags":[313,504],"class_list":["post-1298","post","type-post","status-publish","format-standard","hentry","category-tech","tag-wordpress","tag-wordpress-widget"],"_links":{"self":[{"href":"https:\/\/wopus.org\/index.php?rest_route=\/wp\/v2\/posts\/1298","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wopus.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wopus.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wopus.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wopus.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1298"}],"version-history":[{"count":0,"href":"https:\/\/wopus.org\/index.php?rest_route=\/wp\/v2\/posts\/1298\/revisions"}],"wp:attachment":[{"href":"https:\/\/wopus.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1298"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wopus.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1298"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wopus.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1298"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}