How do I optimize WordPress to reduce CPU usage?
Последна промяна: 15.10.2025 09:03
High CPU usage (e.g., 51.45% of 5.00% limit) can be caused by PHP scripts and database queries. Optimize with these steps:
- Check Stats: Review CPU Stats (https://us.cloudlogin.co/statistics/load-stats/), MySQL Stats (https://us.cloudlogin.co/mysql/stats/), and Web Stats (https://us.cloudlogin.co/statistics/web-stats/).
- Block Bots: Add to .htaccess:
RewriteEngine On RewriteCond %{HTTP_USER_AGENT} ^.*(facebookexternalhit|meta-externalagent|GPTBot|Googlebot|GoogleOther|Amazonbot).*$ [NC] RewriteRule .* - [F,L] - Use Caching Plugins: Install W3 Total Cache (https://wordpress.org/plugins/w3-total-cache/) with Memcached (https://us.cloudlogin.co/help/view-article/?id=521) or WP Fastest Cache (https://wordpress.org/plugins/wp-fastest-cache/).
- Reduce Load: Limit front-page articles and monitor queries with Query Monitor (https://wordpress.org/plugins/query-monitor/).
- Disable WP Cron: Add
define('DISABLE_WP_CRON', true);to wp-config.php and set a cron job in Advanced > Crontab (https://uk.cloudlogin.co/advanced/crontab/) with:wget -q -O - https://domain.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1
hourly. - Upgrade Plan: Consider a Semi-Dedicated plan (https://us.cloudlogin.co/orders/new-plan/) for heavy usage.
See https://wordpress.org/support/article/optimization/ for more details.