MagicWP Docs

Core Management

Manage WordPress core updates, versions, and system maintenance

Core Management

Keep your WordPress installation up-to-date and secure with our comprehensive core management tools.

WordPress Core Updates

Automatic Updates

Enable automatic updates for minor releases and security patches:

// Enable automatic updates in wp-config.php
define('WP_AUTO_UPDATE_CORE', true);

// Or for major versions
define('WP_AUTO_UPDATE_CORE', 'minor');

Manual Updates

For full control over the update process:

  1. Backup First: Always create a backup before updating
  2. Test Environment: Test updates on staging first
  3. Update Core: Use the WordPress admin or CLI
  4. Update Database: Run any required database migrations
  5. Verify Functionality: Test all site features

Update Types

  • Security Patches: Critical security fixes
  • Bug Fixes: Minor bug corrections
  • Performance: Small performance improvements
  • Compatibility: Plugin and theme compatibility updates

Major Updates

  • New Features: Major new functionality
  • API Changes: Breaking changes in core APIs
  • UI Changes: Significant interface updates
  • Database Changes: Major database structure changes

Version Management

Current Version Information

# Check WordPress version
wp core version

# Check for updates
wp core check-update

# View update changelog
wp core get-updates

Version Rollback

If an update causes issues, rollback to a previous version:

# Download specific version
wp core download --version=6.4.0

# Update database if needed
wp core update-db

Core File Integrity

File Checksum Verification

Verify that WordPress core files haven't been modified:

# Verify core files
wp core verify-checksums

# Check specific version
wp core verify-checksums --version=6.4.0

Core File Permissions

Ensure proper file permissions for security:

# Set correct permissions
find /path/to/wordpress -type f -exec chmod 644 {} \;
find /path/to/wordpress -type d -exec chmod 755 {} \;

# Set ownership
chown -R www-data:www-data /path/to/wordpress

Database Management

Database Optimization

Keep your WordPress database running efficiently:

# Optimize database tables
wp db optimize

# Repair corrupted tables
wp db repair

# Check database size
wp db size

Database Updates

Ensure database is compatible with WordPress version:

# Update database structure
wp core update-db

# Check for required updates
wp core update-db-check

Security Hardening

Core Security Settings

// Disable file editing
define('DISALLOW_FILE_EDIT', true);

// Disable plugin/theme installation
define('DISALLOW_FILE_MODS', true);

// Hide WordPress version
remove_action('wp_head', 'wp_generator');

// Disable XML-RPC
add_filter('xmlrpc_enabled', '__return_false');

File System Security

  • Remove unused themes and plugins
  • Update .htaccess with security rules
  • Implement proper file permissions
  • Enable server-level security features

Performance Optimization

Core Performance Settings

// Enable object caching
define('WP_CACHE', true);

// Memory limits
define('WP_MEMORY_LIMIT', '256M');
define('WP_MAX_MEMORY_LIMIT', '512M');

// Disable post revisions
define('WP_POST_REVISIONS', false);

// Optimize autoload
define('WP_AUTOLOAD', false);

Caching Configuration

  • Enable page caching
  • Configure object cache
  • Set up database caching
  • Implement CDN integration

Maintenance Mode

Enable Maintenance Mode

// Create .maintenance file
$content = '<?php $upgrading = ' . time() . '; ?>';
file_put_contents('.maintenance', $content);

// Remove when done
unlink('.maintenance');

Custom Maintenance Page

Create a custom maintenance page:

// functions.php
function custom_maintenance_mode() {
    if (!current_user_can('edit_themes') || !is_user_logged_in()) {
        wp_die(
            '<h1>Site Under Maintenance</h1>
            <p>We\'ll be back soon!</p>',
            'Maintenance',
            array('response' => 503)
        );
    }
}
add_action('get_header', 'custom_maintenance_mode');

Backup and Recovery

Core Backup Strategy

# Full WordPress backup
wp db export backup.sql
tar -czf wordpress-backup.tar.gz /path/to/wordpress

# Selective backup
wp db export --tables=wp_posts,wp_users backup.sql

Recovery Procedures

  1. Restore from backup
  2. Update file permissions
  3. Clear caches
  4. Test functionality
  5. Update DNS if needed

Monitoring and Alerts

Core Health Monitoring

  • Version monitoring: Track WordPress versions
  • Security scanning: Regular security checks
  • Performance monitoring: Track core performance
  • Update notifications: Get notified of available updates

Automated Tasks

  • Daily backups: Automated backup schedules
  • Update checks: Daily update availability checks
  • Health reports: Weekly system health reports
  • Security scans: Regular malware scanning

Troubleshooting

Common Core Issues

White Screen of Death

  • Memory issues: Increase PHP memory limit
  • Plugin conflicts: Deactivate problematic plugins
  • Theme issues: Switch to default theme
  • File corruption: Reinstall WordPress core

Update Failures

  • Permission issues: Check file permissions
  • Memory limits: Increase PHP memory limits
  • Timeout errors: Extend execution time
  • Disk space: Ensure sufficient disk space

Database Errors

  • Connection issues: Verify database credentials
  • Corrupted tables: Repair database tables
  • Character encoding: Fix character set issues
  • InnoDB issues: Convert tables to InnoDB

Debug Mode

Enable debugging for troubleshooting:

// Enable debugging in wp-config.php
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);

// Log errors to file
@ini_set('display_errors', 0);

Best Practices

Update Strategy

  1. Test updates on staging first
  2. Backup before any updates
  3. Update during low-traffic hours
  4. Monitor site after updates
  5. Have rollback plan ready

Security Practices

  1. Keep WordPress updated
  2. Use strong passwords
  3. Limit admin access
  4. Regular security scans
  5. Monitor for suspicious activity

Performance Tips

  1. Enable caching
  2. Optimize database
  3. Use CDN
  4. Minify assets
  5. Monitor performance

Keep your WordPress core healthy and secure with our comprehensive management tools.

On this page