問題描述
我最近被迫編輯外掛的核心檔案。我已經更新了該外掛的標題,以表明它已被編輯。
我的問題是外掛還會收到更新通知嗎?如果是這樣,我可能會停用此外掛的更新,以防止有人忘記我的更新和覆蓋。
理想情況下,我想看看外掛是否可以獲取更新,但是不要讓它們透過點選更新來實現。 (它必須被解除安裝並重新安裝或類似) 。
最佳解決方案
正如 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 輔助翻譯的英文資料結果。如果您對結果不滿意,可以加入我們改善翻譯效果:薇曉朵技術論壇。
