Warning: Undefined array key 0 in /home/yatsuba/yatsuba.com/public_html/wp-content/themes/amaru/functions.php on line 406

Warning: Attempt to read property "parent" on null in /home/yatsuba/yatsuba.com/public_html/wp-content/themes/amaru/functions.php on line 407

Warning: Attempt to read property "term_id" on null in /home/yatsuba/yatsuba.com/public_html/wp-content/themes/amaru/functions.php on line 413

Warning: Attempt to read property "cat_name" on null in /home/yatsuba/yatsuba.com/public_html/wp-content/themes/amaru/functions.php on line 413

WordPressの更新通知を消す方法


Warning: Undefined variable $pre in /home/yatsuba/yatsuba.com/public_html/wp-content/themes/amaru/functions.php on line 517

Warning: Undefined variable $pre in /home/yatsuba/yatsuba.com/public_html/wp-content/themes/amaru/functions.php on line 517
wordpress

WordPressやプラグインは運用・保守、特にセキュリティーの観点から基本的に最新版であるべきです。 しかし最新版に不具合がある場合や、最新版では機能しないシステムがある場合など常に最新版にということが難しい状況もあります。

だからと言って更新しないでおいておくと更新通知が出続け、あまり多くなると他の更新すべきプログラムを見落としてしまうかもしれません。 また別の更新中にうっかりまとめてチェックを付けてしまって更新してしまうこともあり得ます。

そんな時のために、WordPress本体や特定のプラグインに対して更新通知を消す方法です。

WordPress本体の更新通知を消す

functions.PHPに以下のコードを記述します。 本体の更新を止めるのはセキュリティの観点から流石に推奨できませんが、一時しのぎとして使うことはない訳でもありません。 自分が管理していないシステムへの暫定措置として実施することもあります。

dd_filter('pre_site_transient_update_core', create_function('$a', "return null;"));

プラグインの更新通知を消す

functions.PHPに以下のコードを記述します。 複数ある場合はif文節の3行を同じ個所に並記すればOKです。

functions.PHP

dd_filter('site_option__site_transient_update_plugins', 'filter_hide_update_notice');
function filter_hide_update_notice($data) {
    if (isset($data->response['プラグインフォルダ名/メインファイル名'])) {
        unset($data->response['プラグインフォルダ名/メインファイル名']);
    }
}

以下はプラグイン「GoogleXMLSitemap」の更新通知を消す場合の記述例です。

dd_filter('site_option__site_transient_update_plugins', 'filter_hide_update_notice');
function filter_hide_update_notice($data) {
    if (isset($data->response['google-sitemap-generator/sitemap.PHP'])) {
        unset($data->response['google-sitemap-generator/sitemap.PHP']);
    }
}

出来れば常に最新版にしておきたい所ですが、往々にして現実的な問題がそれを阻むことがあります。 こういう事もできると覚えておけばいざという時に役に立つかもしれません。


Warning: Undefined variable $category in /home/yatsuba/yatsuba.com/public_html/wp-content/themes/amaru/content.php on line 79

Warning: Attempt to read property "name" on null in /home/yatsuba/yatsuba.com/public_html/wp-content/themes/amaru/content.php on line 79

の記事

eyecatch

スパムコメントを排除するプラグイン「Akismet」

eyecatch

ブログ初心者におくる「ライティング入門」

eyecatch

viエディタとは

eyecatch

PHP変数の再定義

eyecatch

ウェブサイトに使われる一般的な文字フォント一覧

eyecatch

当たり前に設置されるページャー、実は不要なケースも多い


Warning: Undefined variable $category in /home/yatsuba/yatsuba.com/public_html/wp-content/themes/amaru/content.php on line 84

Warning: Attempt to read property "count" on null in /home/yatsuba/yatsuba.com/public_html/wp-content/themes/amaru/content.php on line 84
HOME