# Fix WordPress Slow Admin Dashboard
The WordPress admin dashboard crawls. Pages take 10+ seconds to load. The editor lags. Saving posts hangs. Every click is an exercise in patience. A slow admin makes content creation painful and often indicates deeper performance issues.
Admin slowness comes from multiple sources: database queries, plugin overhead, the Heartbeat API, lack of caching, and server resource limits.
Quick Diagnosis
Measure Admin Load Time
```bash # Test admin page response time curl -w "Time: %{time_total}s\n" -o /dev/null -s https://yourdomain.com/wp-admin/
# Compare with frontend curl -w "Time: %{time_total}s\n" -o /dev/null -s https://yourdomain.com/ ```
Check Query Monitor
# Install Query Monitor
wp plugin install query-monitor --activateLoad the admin and check Query Monitor panel: - Slow queries - Slow HTTP requests - Hooks with long execution time
Check Server Resources
```bash # Check PHP processes ps aux | grep php
# Check memory usage free -h
# Check disk I/O iostat -x 1 5
# Check database status wp db check ```
Common Causes and Fixes
1. Database Query Overload
Admin pages run many database queries. Slow queries slow everything.
Find slow queries:
```bash # Enable query monitoring in wp-config.php define('SAVEQUERIES', true);
# Or via WP-CLI wp eval ' global $wpdb; $wpdb->queries; ' ```
Optimize database:
```bash # Optimize tables wp db optimize
# Repair tables if needed wp db repair
# Delete old transients wp transient delete --all
# Delete old post revisions wp post delete $(wp post list --post_type=revision --format=ids) --force
# Delete spam comments wp comment delete $(wp comment list --status=spam --format=ids) --force
# Optimize options table wp option delete transient_* ```
Add indexes:
# Add indexes to commonly queried columns
wp db query "ALTER TABLE wp_posts ADD INDEX post_status_type (post_status, post_type)"
wp db query "ALTER TABLE wp_options ADD INDEX autoload (autoload)"2. Object Cache Missing
Admin operations need object cache to avoid repeated queries.
Install object cache:
```bash # Redis (recommended) wp package install wp-cli/redis-command wp redis enable
# Or Memcached wp package install wp-cli/memcached-command ```
Configure Redis:
// In wp-config.php
define('WP_REDIS_HOST', '127.0.0.1');
define('WP_REDIS_PORT', 6379);
define('WP_REDIS_DATABASE', 0);
define('WP_CACHE', true);Install Redis object cache plugin:
wp plugin install redis-cache --activate
wp redis enable
wp redis status3. Heartbeat API Overload
The Heartbeat API makes frequent AJAX calls causing admin slowness.
Control Heartbeat:
# Install Heartbeat Control
wp plugin install heartbeat-control --activateOr disable via code:
```php // In functions.php // Disable Heartbeat in admin add_action('admin_init', function() { wp_deregister_script('heartbeat'); });
// Or reduce frequency add_filter('heartbeat_settings', function($settings) { $settings['interval'] = 60; // 60 seconds instead of 15 return $settings; });
// Disable on specific pages add_action('admin_enqueue_scripts', function() { $screen = get_current_screen(); if ($screen->base === 'post') { wp_deregister_script('heartbeat'); } }); ```
4. Plugin Overload
Too many plugins slow the admin.
Audit plugins:
```bash # Count active plugins wp plugin list --status=active --format=count
# List plugins with load impact # Use Query Monitor to identify slow plugins
# Deactivate unnecessary plugins wp plugin deactivate unused-plugin wp plugin delete unused-plugin ```
Find slow plugins via Query Monitor:
Install Query Monitor and check "Plugins" tab for execution times.
5. Dashboard Widgets
Dashboard widgets query external data and slow load.
Remove dashboard widgets:
// In functions.php
add_action('admin_init', function() {
remove_meta_box('dashboard_primary', 'dashboard', 'side'); // WordPress news
remove_meta_box('dashboard_secondary', 'dashboard', 'side');
remove_meta_box('dashboard_quick_press', 'dashboard', 'side');
remove_meta_box('dashboard_recent_drafts', 'dashboard', 'side');
remove_meta_box('dashboard_site_health', 'dashboard', 'normal');
remove_meta_box('dashboard_php_nag', 'dashboard', 'normal');
});Or via admin:
Dashboard > Screen Options > Uncheck widgets
6. Admin Menu Overload
Complex admin menus from plugins add query overhead.
Simplify admin menu:
// Remove unnecessary menu items
add_action('admin_menu', function() {
remove_menu_page('plugins.php'); // Plugins
remove_menu_page('tools.php'); // Tools
// Keep only essential items
}, 999);7. PHP Memory Limit
Admin operations need more memory.
// In wp-config.php
define('WP_MEMORY_LIMIT', '256M');
define('WP_MAX_MEMORY_LIMIT', '512M');8. PHP Execution Time
Long operations timeout.
// In wp-config.php
set_time_limit(300);Or in php.ini:
max_execution_time = 3009. Post List Query Overload
Posts list pages query all posts, slow on large sites.
Limit posts per page:
// In functions.php
add_filter('edit_posts_per_page', function() {
return 20; // Fewer posts per page
});Disable expensive columns:
add_filter('manage_posts_columns', function($columns) {
unset($columns['comments']); // Remove comments column
return $columns;
});10. WooCommerce Admin Slow
WooCommerce adds significant admin overhead.
WooCommerce optimization:
```bash # Clear transients wp wc tool run clear_transients --user=1
# Regenerate lookup tables wp wc tool run regenerate_product_lookup_tables --user=1
# Clear customer lookup wp wc tool run clear_customer_lookup_cache --user=1
# Disable WooCommerce admin analytics widget wp option update woocommerce_admin_activity_panel_enabled 'no' ```
Reduce WooCommerce features:
// Disable WooCommerce admin features
add_filter('woocommerce_admin_features', function($features) {
return array_diff($features, array('analytics', 'reports'));
});Server-Level Optimization
PHP-FPM Tuning
# In www.conf or php-fpm pool config
pm = dynamic
pm.max_children = 50
pm.start_servers = 10
pm.min_spare_servers = 5
pm.max_spare_servers = 20
pm.max_requests = 500MySQL Tuning
# In my.cnf
innodb_buffer_pool_size = 1G
innodb_log_file_size = 256M
query_cache_size = 64M
tmp_table_size = 64M
max_heap_table_size = 64MNginx FastCGI Cache
```nginx # In nginx config fastcgi_cache_path /var/cache/nginx levels=1:2 keys_zone=wordpress:100m inactive=60m; fastcgi_cache_key "$scheme$request_method$host$request_uri";
location ~ \.php$ { fastcgi_cache wordpress; fastcgi_cache_valid 200 60m; # Cache admin selectively } ```
Apache Tuning
```apache # In apache2.conf KeepAlive On MaxKeepAliveRequests 100 KeepAliveTimeout 5
<IfModule mpm_prefork_module> StartServers 5 MinSpareServers 5 MaxSpareServers 10 MaxRequestWorkers 150 MaxConnectionsPerChild 0 </IfModule> ```
Debug Admin Performance
Enable Query Monitoring
// In wp-config.php (temporary, remove after debugging)
define('SAVEQUERIES', true);
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);Log slow queries:
add_filter('log_query_custom_data', function($data, $query, $time) {
if ($time > 0.1) { // Log queries over 100ms
error_log("Slow query ($time seconds): $query");
}
return $data;
}, 10, 3);Profile PHP Execution
```bash # Install XHProf sudo apt install php-xhprof
# Profile admin pages # Add to wp-config.php: if (isset($_GET['profile'])) { xhprof_enable(XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY); register_shutdown_function(function() { $data = xhprof_disable(); // Save $data for analysis }); } ```
Monitor AJAX Calls
Browser DevTools > Network tab shows AJAX calls causing slowdown.
WP-CLI Alternative
When admin is unusable, manage via WP-CLI:
```bash # Create posts wp post create --post_type=post --post_title="New Post"
# Manage plugins wp plugin list wp plugin deactivate slow-plugin
# Manage users wp user list
# Update content wp post update 123 --post_content="New content"
# Export content wp export --dir=/tmp/export ```
Verification
After optimization:
```bash # Test admin load time curl -w "Time: %{time_total}s\n" -o /dev/null -s https://yourdomain.com/wp-admin/ # Should be under 2 seconds
# Test specific admin pages curl -w "Time: %{time_total}s\n" -o /dev/null -s https://yourdomain.com/wp-admin/edit.php curl -w "Time: %{time_total}s\n" -o /dev/null -s https://yourdomain.com/wp-admin/post-new.php
# Check query count # With Query Monitor: should be under 100 queries per page
# Check object cache hit rate wp redis stats ```
Quick Reference
| Issue | Cause | Fix |
|---|---|---|
| Dashboard slow | Widgets loading | Remove widgets |
| Posts list slow | Large query | Limit per page, optimize DB |
| Editor slow | Heartbeat API | Reduce/disable heartbeat |
| All pages slow | No object cache | Enable Redis/Memcached |
| Saving slow | PHP limits | Increase memory/time |
| WooCommerce slow | Reports overhead | Disable analytics features |
Admin performance requires attacking multiple fronts: database optimization, object caching, Heartbeat control, plugin auditing, and server tuning. Start with Query Monitor to identify the biggest bottlenecks, then apply targeted fixes.