If you’re reading this, you’re likely tired of the 一般的なWordPressのパフォーマンスアドバイス. The usual routine—installing WP Rocket, adding an image optimizer plugin, and throwing in an asset manager—often leads to a paradox: サイトを高速化するためにプラグインをインストールしても、そのプラグイン自体がデータベースの肥大化、バックグラウンドのcronジョブ、そして独自のCSS/JSペイロードを追加してしまうのです。
The truth is, WordPress doesn’t need 15 performance plugins to load in under a second. True speed optimization happens at the metal layer—the server, the database, and the core code.
このガイドでは、プラグインエコシステムを完全に回避します。サーバー側の設定、 wp-config.php 調整、そして外科的な functions.php スニペットを使用してWordPressを最適化します。
1. サーバー側の基盤(PHPは不要)
WordPressのコードを一行も触る前に、サーバー環境を徹底的に最適化する必要があります。弱いサーバーはフロントエンドのキャッシュでは修正できません。
PHP 8.1以上にアップグレード
WordPressはPHPで動作します。PHP 7.4からPHP 8.1または8.2に移行することで、実行時間を20〜30%短縮し、メモリ消費量を大幅に削減できます。 アクション: cPanel、Plesk、または独自のVPSを管理している場合はCLI経由でこれを変更してください。
サーバーレベルの圧縮を有効にする(GzipよりBrotli)
Gzipは標準的ですが、 Brotli (Googleが開発)は、同じCPUコストでテキストファイル(HTML、CSS、JS)に対して約15〜20%優れた圧縮率を提供します。 アクション(Nginx): あなたの nginx.conf でBrotliが有効になっていることを確認してください:
brotli on;
brotli_comp_level 6;
brotli_types text/plain text/css application/javascript application/json image/svg+xml;
FastCGIキャッシュ(Nginx)またはLiteSpeedキャッシュを実装する
PHPベースのキャッシュプラグイン(キャッシュを提供するためにWordPressの一部読み込みが必要)を使用する代わりに、Webサーバーレベルでキャッシュを行います。Nginx FastCGIキャッシュは、生成されたHTMLをRAMまたはディスクに保存し、直接提供することで、匿名訪問者に対してPHPとMySQLを完全にバイパスします。
2. 次によるハードニングと軽量化 wp-config.php
の wp-config.php ファイルはあなたのコントロールルームです。デフォルトでは、WordPressは時間の経過とともにデータベースを肥大化させる特定の動作を許可しています。
これらのスニペットを /* That's all, stop editing! Happy publishing. */ 行の直前に追加してください。
投稿リビジョンの制限
デフォルトでは、WordPressは投稿のリビジョンを無制限に保存します。50回更新された投稿は、 wp_posts データベーステーブルに50個のコピーを持つことになり、データベースクエリを劇的に遅くします。
// Keep only the last 3 revisions
define( 'WP_POST_REVISIONS', 3 );
自動保存間隔の最適化
WordPressは60秒ごとに自動保存します。複数の編集者が作業している場合、これはデータベースに大きな負荷をかけます。間隔を長くしましょう。
// Change autosave from 60 seconds to 5 minutes
define( 'AUTOSAVE_INTERVAL', 300 );
ゴミ箱をより速く空にする
削除された投稿やコメントは30日間データベースに残ります。これを減らしてデータベースをスリムに保ちましょう。
// Empty trash every 7 days
define( 'EMPTY_TRASH_DAYS', 7 );
3. The “Anti-Bloat” functions.php マスタースニペット
WordPressコアは、デフォルトで大量のレガシーサポートスクリプト、ディスカバリーリンク、インラインスタイルを <head> そして <footer> に注入します。
To achieve maximum information gain over competitors, we won’t just tell you to “use a debloat plugin.” Here is the exact code to surgically remove the most common WordPress bloat.
Note: Add this to your Child Theme’s functions.php またはドロップインmu-pluginに追加してください。
/**
* The Ultimate WordPress Debloat Snippet
*/
add_action('init', function() {
// 1. Remove RSD, XMLRPC, and WLW links
remove_action('wp_head', 'rsd_link');
remove_action('wp_head', 'wlwmanifest_link');
add_filter('xmlrpc_enabled', '__return_false');
// 2. Remove WordPress version footprint (Security & Speed)
remove_action('wp_head', 'wp_generator');
// 3. Remove Shortlinks and REST API links from header
remove_action('wp_head', 'wp_shortlink_wp_head');
remove_action('wp_head', 'rest_output_link_wp_head');
// 4. Disable native Emojis (Saves 1 JS and 1 CSS HTTP Request)
remove_action('wp_head', 'print_emoji_detection_script', 7);
remove_action('wp_print_styles', 'print_emoji_styles');
remove_action('admin_print_scripts', 'print_emoji_detection_script');
remove_action('admin_print_styles', 'print_emoji_styles');
remove_filter('the_content_feed', 'wp_staticize_emoji');
remove_filter('comment_text_rss', 'wp_staticize_emoji');
remove_filter('wp_mail', 'wp_staticize_emoji_for_email');
// 5. Disable oEmbeds (If you don't embed external URLs automatically)
remove_action('wp_head', 'wp_oembed_add_discovery_links');
remove_action('wp_head', 'wp_oembed_add_host_js');
add_action('wp_footer', function() { wp_deregister_script('wp-embed'); });
});
/**
* 6. Remove Global Styles (WP 5.9+ Inline CSS Bloat)
*/
add_action('wp_enqueue_scripts', function() {
wp_dequeue_style('global-styles');
wp_dequeue_style('classic-theme-styles');
}, 100);
/**
* 7. Remove jQuery Migrate (If using modern themes/plugins)
*/
add_action('wp_default_scripts', function($scripts) {
if (!is_admin() && isset($scripts->registered['jquery'])) {
$script = $scripts->registered['jquery'];
if ($script->deps) {
$script->deps = array_diff($script->deps, ['jquery-migrate']);
}
}
});
/**
* 8. Throttle the Heartbeat API
* Prevents high CPU usage when leaving the WP Admin open
*/
add_filter('heartbeat_settings', function($settings) {
$settings['interval'] = 60; // Throttle to 60 seconds
return $settings;
});
何が達成できたのでしょうか?
上記のコードを追加することで、即座に最大 5〜8個の不要なHTTPリクエスト and removed dozens of lines of inline CSS/JS from every single page load—all without installing a single plugin.
4. メディアの最適化(ハードな方法)
SmushやImagifyのようなプラグインは便利ですが、PHPサーバー上で画像処理を実行するため、CPUリソースを消費します。
手動でのWebP/AVIF変換
画像をWordPressにアップロードする前に、 Squoosh.app (Google製)や TinyPNGのような外部のロスレス圧縮ツールを通してください。さらに良いのは、アップロード前にローカルで .webp や .avif またはAVIF形式に変換することです。
ネイティブの遅延読み込み(Lazy Loading)を活用する
WordPress 5.5以降、ネイティブの遅延読み込みが組み込まれています。WordPressは自動的に画像に loading="lazy" to your images. You don’t need a JavaScript-based lazy loading plugin. However, ensure your “above the fold” images (like your logo or hero image) DO NOT have this attribute, as it will delay the Largest Contentful Paint (LCP).
ページ内の最初の画像から遅延読み込みを削除するには、以下を使用します。 functions.php:
add_filter( 'wp_get_attachment_image_attributes', function( $attr, $attachment, $size ) {
static $is_first_image = true;
if ( $is_first_image ) {
$attr['loading'] = 'eager'; // Force immediate load for LCP
$is_first_image = false;
}
return $attr;
}, 10, 3 );
5. phpMyAdminによるデータベースのデフラグ
Optimization plugins usually feature a “Clean Database” button. You can do this natively at the database level.
- ホスティングパネルにログインし、 phpMyAdmin.
- を開きます。WordPressデータベースを選択します。
- 一番下までスクロールし、 すべてチェック.
- In the “With selected:” dropdown, choose テーブルを最適化.
を選択します。MySQLがテーブルインデックスを再構築し、未使用の領域を回収します。これを月に一度手動で行ってください。
評決
Optimizing WordPress without plugins isn’t just about saving money on premium subscriptions. It is a philosophy of 技術的負債を削減する. Every plugin you don’t install is a security vulnerability you don’t have to patch, a database table you don’t have to clean, and a PHP script your server doesn’t have to execute.
ワークロードをサーバー(PHP 8.1+、Nginx FastCGI)に移行し、 wp-config.phpにおいて規律を強制し、 functions.phpを使用してコアの肥大化を削ぎ落とします。Time to First Byte (TTFB) と Core Web Vitals にその違いが反映されるでしょう。



