問題描述
我最近被迫編輯插件的核心文件。我已經更新了該插件的標題,以表明它已被編輯。
我的問題是插件還會收到更新通知嗎?如果是這樣,我可能會禁用此插件的更新,以防止有人忘記我的更新和覆蓋。
理想情況下,我想看看插件是否可以獲取更新,但是不要讓它們通過點擊更新來實現。 (它必須被卸載並重新安裝或類似) 。
最佳解決方案
正如 SickHippie 所説和 AFAIK 一樣,你不能同時擁有。我在這個堆棧中收集到的信息中添加了一個答案。
Disable update notification for individual plugins
網友評論:
Simply open up the plugin file and change the version number to something like 9.9.9
Hameedullah Khan 的答案 (刪除 Akismet 更新通知):
function filter_plugin_updates( $value ) {
unset( $value->response['akismet/akismet.php'] );
return $value;
}
add_filter( 'site_transient_update_plugins', 'filter_plugin_updates' );
What Triggers a Plugin Update Alert
奧託的答案:
The API uses a rather elaborate mechanism to match plugins against plugins it knows about, but these are the main things checked for: Plugin URI, Plugin Name, and Plugin slug (the directory name the plugin is in)
Change any of those and you reduce the chances of it finding a match, but it might still get it if two of them match, for example.
Info in the readme.txt is not used for this. The header of the plugin’s PHP file itself is used.
替代方法 1
-
修改插件以檢查您自己的自定義存儲庫中的更新。
-
您將不得不按照原始的插件更新,定期訪問官方的 Repo 或將原始安裝在某些其他 WordPress 安裝中。
-
當您決定修改後的插件必須更新時,將其提交給您的 Repo,您將收到通知
-
教程:http://wp.tutsplus.com/tutorials/plugins/a-guide-to-the-wordpress-http-api-automatic-plugin-updates/
-
布拉德·威廉姆斯,奧日爾·理查德和賈斯汀·塔德洛克的書 Professional WordPress Plugin Development 有一章關於這個問題
備註方法 2 從評論中提取
-
更改插件名稱,版本號和目錄名稱
-
安裝原始插件,但將其停用以接收更新通知
-
添加一個自定義消息到插件描述 (或替換原來的)
-
刪除插件操作 (激活|編輯|刪除) 和批量操作的複選框
add_filter( 'all_plugins', 'wpse_56968_on_list_plugins' );
add_filter( 'plugin_action_links_akismet/akismet.php', 'wpse_56968_remove_plugin_actions', 10, 4 );
add_action( 'admin_head-plugins.php', 'wpse_56968_remove_plugin_checkbox' );
function wpse_56968_on_list_plugins( $plugins )
{
$plugins['akismet/akismet.php']['Description'] = '<strong>*** NOTICE: PLUGIN ONLY TO CHECK UPDATES IN THE ORIGINAL ONE! ***</strong> ';// . $plugins['akismet/akismet.php']['Description'];
return $plugins;
}
function wpse_56968_remove_plugin_actions( $actions, $plugin_file, $plugin_data, $context )
{
unset( $actions['activate'], $actions['edit'], $actions['delete'] );
return $actions;
}
function wpse_56968_remove_plugin_checkbox()
{
?>
<script type="text/javascript">
jQuery(document).ready( function($) {
$('tr#akismet th.check-column').html(' ')
});
</script>
<?php
}
相關核心門票
次佳解決方案
您不能禁用更新,但不能更新通知 – 它們綁定在一起。
要完全禁用通知,請更改插件所在的文件夾名稱。
我的個人方法是在主 plugin.php 文件中添加 3 a 的插件標題,所以在我的插件列表中,我看到了 AAA/Plugin Name 。這將放在列表的頂部以供參考,並將在插件列表和更新列表中顯示。它基本上是一個個人標誌,所以我知道不要自動更新這些特定的插件。
參考文獻
注:本文內容整合自 Google/Baidu/Bing 輔助翻譯的英文資料結果。如果您對結果不滿意,可以加入我們改善翻譯效果:薇曉朵技術論壇。
