This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- Diagnose slow wp_postmeta queries using EXPLAIN | |
| -- Run these in phpMyAdmin or WP-CLI: wp db query < file.sql | |
| -- Check the current indexes on wp_postmeta | |
| SHOW INDEX FROM wp_postmeta; | |
| -- Typical slow query: find posts by a custom field value | |
| -- This is what WP_Query does with meta_query | |
| EXPLAIN SELECT post_id | |
| FROM wp_postmeta |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sudo apt update | |
| sudo apt install redis-server -y | |
| # Verify Redis is running | |
| sudo systemctl status redis-server | |
| # Test connection | |
| redis-cli ping | |
| # Should respond: PONG |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # BEGIN WordPress | |
| <IfModule mod_rewrite.c> | |
| RewriteEngine On | |
| RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] | |
| RewriteBase / | |
| RewriteRule ^index\.php$ - [L] | |
| RewriteCond %{REQUEST_FILENAME} !-f | |
| RewriteCond %{REQUEST_FILENAME} !-d | |
| RewriteRule . /index.php [L] | |
| </IfModule> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- How WordPress stores transients in wp_options: | |
| -- | option_name | option_value | autoload | | |
| -- |------------------------------|----------------|----------| | |
| -- | _transient_my_data | (serialized) | no | | |
| -- | _transient_timeout_my_data | 1740211200 | no | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| define( 'WP_MEMORY_LIMIT', '256M' ); | |
| define( 'WP_MAX_MEMORY_LIMIT', '512M' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Enable WordPress debug mode | |
| define( 'WP_DEBUG', true ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| wp search-replace 'old-string' 'new-string' [table...] [--dry-run] [--precise] [--all-tables] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Total size of all autoloaded data | |
| wp db query "SELECT SUM(LENGTH(option_value)) AS autoload_size FROM wp_options WHERE autoload = 'yes';" | |
| # Count of autoloaded options | |
| wp db query "SELECT COUNT(*) AS autoload_count FROM wp_options WHERE autoload = 'yes';" | |
| # Top 20 largest autoloaded options (the ones causing bloat) | |
| wp db query "SELECT option_name, LENGTH(option_value) AS size_bytes, LEFT(option_value, 80) AS preview FROM wp_options WHERE autoload = 'yes' ORDER BY LENGTH(option_value) DESC LIMIT 20;" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Check WPVivid version on a single site | |
| wp plugin list --name=wpvivid-backuprestore --fields=name,version,status | |
| # Check across all sites on a multisite network | |
| wp site list --field=url | xargs -I {} wp plugin list --name=wpvivid-backuprestore --fields=name,version,status --url={} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT COUNT(*) FROM wp_posts WHERE post_type = 'revision'; |