{"id":1091,"date":"2009-05-21T07:42:30","date_gmt":"2009-05-20T23:42:30","guid":{"rendered":"https:\/\/www.wopus.org\/?p=1091"},"modified":"2009-05-21T07:42:30","modified_gmt":"2009-05-20T23:42:30","slug":"%e7%a6%81%e7%94%a8%e7%89%b9%e5%ae%9awordpress%e6%8f%92%e4%bb%b6%e7%9a%84%e8%87%aa%e5%8a%a8%e5%8d%87%e7%ba%a7","status":"publish","type":"post","link":"https:\/\/wopus.org\/?p=1091","title":{"rendered":"\u7981\u7528\u7279\u5b9aWordPress\u63d2\u4ef6\u7684\u81ea\u52a8\u5347\u7ea7"},"content":{"rendered":"<p>WordPress\u7a0b\u5e8f\u5b9e\u73b0\u4e86\u540e\u53f0\u63d2\u4ef6\u7684\u5728\u7ebf\u5b89\u88c5\u548c\u5728\u7ebf\u5347\u7ea7\uff0c\u4f46\u6709\u4e9b\u670b\u53cb\u4e0d\u60f3\u4e0d\u60f3\u5347\u7ea7\u63d2\u4ef6\uff0c\u4e5f\u4e0d\u613f\u610f\u770b\u5230\u5347\u7ea7\u7684\u63d0\u793a\uff0c\u5f88\u788d\u773c\uff0c\u5982\u4f55\u624d\u80fd\u7981\u7528\u8fd9\u4e2a\u63d2\u4ef6\u7684\u81ea\u52a8\u5347\u7ea7\u63d0\u793a\u5462\uff1f<\/p>\n<p>\u65b9\u6cd5\u5f88\u7b80\u5355\uff0c\u5c06\u63d2\u4ef6\u6240\u5728\u7684\u6587\u4ef6\u5939\u540d\uff0c\u63d2\u4ef6\u6587\u4ef6\u7684\u540d\u79f0\uff0c\u63d2\u4ef6\u5934\u6587\u4ef6\u4e2d\u7684\u63d2\u4ef6\u540d\uff0c\u8fd9\u4e9b\u7edf\u7edf\u4fee\u6539\u4e3a\u5176\u4ed6\u503c\uff0c\u8fd9\u6837\uff0c\u8be5\u63d2\u4ef6\u4fbf\u4e0d\u4f1a\u88ab WP.org \u8bc6\u522b\uff0c\u4e5f\u5c31\u4e0d\u4f1a\u6709\u81ea\u52a8\u5347\u7ea7\u7684\u95ee\u9898\u3002<\/p>\n<p><strong>\u53e6\u5916\u8fd8\u63d0\u4f9b\u56db\u79cd\u89e3\u51b3\u65b9\u6cd5\uff1a<\/strong><br \/>\n1. \u5b8c\u5168\u7981\u7528\u5347\u7ea7\u63d0\u793a<br \/>\n\u5b8c\u5168\u7981\u7528\u5347\u7ea7\u63d0\u793a\uff0c\u8bf7\u5c06\u4ee5\u4e0b\u4ee3\u7801\u5199\u5165\u63d2\u4ef6\u7684\u4e3b\u6587\u4ef6\u4e2d\uff1a<br \/>\n<code><br \/>\nadd_filter('option_update_plugins', 'plugin_prevent_upgrade');<br \/>\nfunction plugin_prevent_upgrade($opt){<br \/>\n$plugin = plugin_basename(__FILE__);<br \/>\nif($opt &amp;&amp; isset($opt-&gt;response[$plugin])){<br \/>\n\/\/\u6709\u5347\u7ea7\u63d0\u793a\uff1f\u53bb\u9664\u4e4b<br \/>\nunset($opt-&gt;response[$plugin]);<br \/>\n}<br \/>\nreturn $opt;<br \/>\n}<br \/>\n<\/code><br \/>\n\u8fd9\u4e2a\u65b9\u6848\u7684\u7f3a\u70b9\u662f\uff0c\u4e0d\u77e5\u9053\u6709\u8be5\u63d2\u4ef6\u7684\u5347\u7ea7\u5b58\u5728\uff0c\u9664\u975e\u67e5\u770b\u5b83\u7684\u7ad9\u70b9\u3002\u8fd9\u662f\u6700\u7edd\u7684\u65b9\u6cd5\u3002<\/p>\n<p>2. \u4fdd\u7559\u5347\u7ea7\u63d0\u793a\uff0c\u4f46\u53bb\u9664\u5347\u7ea7\u94fe\u63a5<br \/>\n<code><br \/>\nadd_filter('option_update_plugins', 'plugin_prevent_upgrade');<br \/>\nfunction plugin_prevent_upgrade($opt){<br \/>\n$plugin = plugin_basename(__FILE__);<br \/>\nif($opt &amp;&amp; isset($opt-&gt;response[$plugin])){<br \/>\n\/\/\u6709\u5347\u7ea7\u63d0\u793a\uff1f\u53bb\u9664\u81ea\u52a8\u5347\u7ea7\u7684\u529f\u80fd<br \/>\n$opt-&gt;response[$plugin]-&gt;package = '';<br \/>\n}<br \/>\nreturn $opt;<br \/>\n}<br \/>\n<\/code><br \/>\n\u8fd9\u6837\u53ef\u4ee5\u77e5\u9053\u8be5\u63d2\u4ef6\u6709\u5347\u7ea7\u7248\u672c\uff0c\u4f46\u4e0d\u901a\u8fc7\u81ea\u5e26\u7684\u5347\u7ea7\u7a0b\u5e8f\u3002\u81ea\u52a8\u7684\u603b\u662f\u4e0d\u653e\u5fc3\u3002<\/p>\n<p>3. \u53bb\u9664\u81ea\u52a8\u5347\u7ea7\u529f\u80fd\uff0c\u66ff\u6362\u4e3a\u5176\u4ed6\u7684\u63d0\u793a\u4fe1\u606f<br \/>\n<code><br \/>\nadd_filter('option_update_plugins', 'plugin_prevent_upgrade');<br \/>\nfunction plugin_prevent_upgrade($opt){<br \/>\n$plugin = plugin_basename(__FILE__);<br \/>\nif($opt &amp;&amp; isset($opt-&gt;response[$plugin])){<br \/>\n\/\/\u6709\u5347\u7ea7\u63d0\u793a\uff1f\u53bb\u9664\u4e4b<br \/>\nunset($opt-&gt;response[$plugin]);<\/code><\/p>\n<p><code>\/\/\u81ea\u5b9a\u4e49\u7684\u63d0\u793a\u4fe1\u606f<br \/>\nadd_action(\"after_plugin_row_$plugin\", 'plugin_update_disabled_notice');<br \/>\n}<br \/>\nreturn $opt;<br \/>\n}<br \/>\nfunction plugin_update_disabled_notice(){<br \/>\necho '<\/code><\/p>\n<p><code> <\/code><\/p>\n<p>\u8fd9\u4e00\u62db\u53ef\u4ee5\u7528\u5728\u4f60\u7684\u5ba2\u6237\u8eab\u4e0a\uff0c\u5ba2\u6237\u4e0d\u4e00\u5b9a\u662f\u4e13\u4e1a\u7684\u4eba\u5458\uff0c\u4e07\u4e00\u51fa\u4e86\u4ec0\u4e48\u95ee\u9898\u5462\uff0c\u6309\u7167\u63d0\u793a\u8054\u7cfb\u4e13\u4e1a\u4eba\u58eb\u5427\u3002<\/p>\n<p>4. \u4fdd\u7559\u5347\u7ea7\u63d0\u793a\uff0c\u53bb\u9664\u81ea\u52a8\u5347\u7ea7\u529f\u80fd\uff0c\u540c\u65f6\u52a0\u5165\u5176\u4ed6\u7684\u63d0\u793a\u4fe1\u606f<br \/>\n<code>add_filter('option_update_plugins', 'plugin_prevent_upgrade');<br \/>\nfunction plugin_prevent_upgrade($opt){<br \/>\n$plugin = plugin_basename(__FILE__);<br \/>\nif($opt &amp;&amp; isset($opt-&gt;response[$plugin])){<br \/>\n\/\/\u6709\u5347\u7ea7\u63d0\u793a\uff1f\u53bb\u9664\u81ea\u52a8\u5347\u7ea7\u529f\u80fd<br \/>\n$opt-&gt;response[$plugin]-&gt;package = '';<br \/>\n\/\/\u81ea\u5b9a\u4e49\u7684\u63d0\u793a\u4fe1\u606f<br \/>\nadd_action(\"after_plugin_row_$plugin\", 'plugin_update_disabled_notice');<br \/>\n}<br \/>\nreturn $opt;<br \/>\n}<br \/>\nfunction plugin_update_disabled_notice(){<br \/>\necho '<br \/>\n<\/code><\/p>\n<p><strong>\u5c0f\u63d0\u793a\uff1a\u7981\u6b62\u6240\u6709\u63d2\u4ef6\u7684\u5347\u7ea7\u63d0\u793a<\/strong><br \/>\n\u5982\u679c\u8981\u7981\u6b62\u6240\u6709\u63d2\u4ef6\u7684\u5347\u7ea7\u63d0\u793a\uff0c\u8bf7\u5728\u4e3b\u9898\u7684 functions.php \u4e2d\u5199\u5165\u4ee5\u4e0b\u4ee3\u7801\uff1a<br \/>\n<code>add_action('admin_menu', create_function('$a', \"remove_action('admin_init', 'wp_update_plugins');\"));<br \/>\nadd_action('admin_menu', create_function('$a', \"remove_action('admin_init', '_maybe_update_plugins');\"));<br \/>\nadd_action('admin_init', create_function('$a', \"remove_action('load-plugins.php', 'wp_update_plugins');\"));<br \/>\nadd_action('plugins_loaded', create_function('$a', \"remove_action('init', 'wp_update_plugins');\"));<br \/>\nadd_action('admin_init', create_function('$a', \"remove_action('after_plugin_row', 'wp_plugin_update_row');\"));<br \/>\n<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>WordPress\u7a0b\u5e8f\u5b9e\u73b0\u4e86\u540e\u53f0\u63d2\u4ef6\u7684\u5728\u7ebf\u5b89\u88c5\u548c\u5728\u7ebf\u5347\u7ea7\uff0c\u4f46\u6709\u4e9b\u670b\u53cb\u4e0d\u60f3\u4e0d\u60f3\u5347\u7ea7\u63d2\u4ef6\uff0c\u4e5f\u4e0d\u613f\u610f\u770b\u5230\u5347\u7ea7\u7684\u63d0\u793a\uff0c\u5f88\u788d\u773c\uff0c\u5982\u4f55\u624d\u80fd\u7981\u7528\u8fd9\u4e2a\u63d2\u4ef6\u7684\u81ea\u52a8\u5347\u7ea7\u63d0\u793a\u5462\uff1f \u65b9\u6cd5\u5f88\u7b80\u5355\uff0c\u5c06\u63d2\u4ef6\u6240\u5728\u7684\u6587\u4ef6\u5939\u540d\uff0c\u63d2\u4ef6\u6587\u4ef6\u7684\u540d\u79f0\uff0c\u63d2\u4ef6\u5934\u6587\u4ef6\u4e2d\u7684\u63d2\u4ef6\u540d\uff0c\u8fd9\u4e9b\u7edf\u7edf\u4fee\u6539\u4e3a\u5176\u4ed6\u503c\uff0c\u8fd9\u6837\uff0c\u8be5\u63d2\u4ef6\u4fbf\u4e0d\u4f1a\u88ab WP.org \u8bc6\u522b\uff0c\u4e5f\u5c31\u4e0d\u4f1a\u6709\u81ea\u52a8\u5347\u7ea7\u7684\u95ee\u9898\u3002 \u53e6\u5916\u8fd8\u63d0\u4f9b\u56db\u79cd\u89e3\u51b3\u65b9\u6cd5\uff1a 1. \u5b8c\u5168\u7981\u7528\u5347\u7ea7\u63d0\u793a \u5b8c\u5168\u7981\u7528\u5347\u7ea7\u63d0\u793a\uff0c\u8bf7\u5c06\u4ee5\u4e0b\u4ee3\u7801\u5199\u5165\u63d2\u4ef6\u7684\u4e3b\u6587\u4ef6\u4e2d\uff1a add_filter(&#8216;option_update_plugins&#8217;, &#8216;plugin_prevent_upgrade&#8217;); function plugin_prevent_upgrade($opt){ $plugin = plugin_basename(__FILE__); if($opt &amp;&amp; isset($opt-&gt;response[$plugin])){ \/\/\u6709\u5347\u7ea7\u63d0\u793a\uff1f\u53bb\u9664\u4e4b unset($opt-&gt;response[$plugin]); } return $opt; } \u8fd9\u4e2a\u65b9\u6848\u7684\u7f3a\u70b9\u662f\uff0c\u4e0d\u77e5\u9053\u6709\u8be5\u63d2\u4ef6\u7684\u5347\u7ea7\u5b58\u5728\uff0c\u9664\u975e\u67e5\u770b\u5b83\u7684\u7ad9\u70b9\u3002\u8fd9\u662f\u6700\u7edd\u7684\u65b9\u6cd5\u3002 2. \u4fdd\u7559\u5347\u7ea7\u63d0\u793a\uff0c\u4f46\u53bb\u9664\u5347\u7ea7\u94fe\u63a5 add_filter(&#8216;option_update_plugins&#8217;, &#8216;plugin_prevent_upgrade&#8217;); function plugin_prevent_upgrade($opt){ $plugin = plugin_basename(__FILE__); if($opt &amp;&amp; isset($opt-&gt;response[$plugin])){ \/\/\u6709\u5347\u7ea7\u63d0\u793a\uff1f\u53bb\u9664\u81ea\u52a8\u5347\u7ea7\u7684\u529f\u80fd $opt-&gt;response[$plugin]-&gt;package = &#8221;; } return $opt; } \u8fd9\u6837\u53ef\u4ee5\u77e5\u9053\u8be5\u63d2\u4ef6\u6709\u5347\u7ea7\u7248\u672c\uff0c\u4f46\u4e0d\u901a\u8fc7\u81ea\u5e26\u7684\u5347\u7ea7\u7a0b\u5e8f\u3002\u81ea\u52a8\u7684\u603b\u662f\u4e0d\u653e\u5fc3\u3002 3. \u53bb\u9664\u81ea\u52a8\u5347\u7ea7\u529f\u80fd\uff0c\u66ff\u6362\u4e3a\u5176\u4ed6\u7684\u63d0\u793a\u4fe1\u606f add_filter(&#8216;option_update_plugins&#8217;, &#8216;plugin_prevent_upgrade&#8217;); function plugin_prevent_upgrade($opt){ $plugin = plugin_basename(__FILE__); [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19],"tags":[607],"class_list":["post-1091","post","type-post","status-publish","format-standard","hentry","category-basic-use","tag-wordpress"],"_links":{"self":[{"href":"https:\/\/wopus.org\/index.php?rest_route=\/wp\/v2\/posts\/1091","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=1091"}],"version-history":[{"count":0,"href":"https:\/\/wopus.org\/index.php?rest_route=\/wp\/v2\/posts\/1091\/revisions"}],"wp:attachment":[{"href":"https:\/\/wopus.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1091"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wopus.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1091"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wopus.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1091"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}