📘 User Manual - PRO Version 1.3.1
WP Optimal State PRO is an advanced, all-in-one WordPress optimization and management suite. It was built on the philosophy that site management should be comprehensive, secure, and powerful. It provides a complete set of tools to clean, optimize, back up, and secure your WordPress database, combined with a robust performance module to make your site exceptionally fast.
This plugin is not just a simple "cleaner." It's a complete toolkit for database management and site performance, giving you both "one-click" simplicity and the granular, advanced control that professionals demand.
This manual is for every user of WP Optimal State PRO.
🚨 WARNING: THIS IS A POWERFUL TOOLWP Optimal State PRO interacts directly and deeply with your website's database. Operations like cleanup, optimization, and restoration are powerful and, in most cases, irreversible.
While this plugin includes its own robust, best-in-class backup system, we cannot overstate the importance of caution.
💾 Before performing ANY cleanup or restore operation, you MUST create a fresh backup.
The plugin's built-in "Safety Backup" feature during restores provides a strong safety net, but a separate, downloadable backup is your ultimate insurance policy. Use this plugin responsibly. The author and this manual are not responsible for any data loss.
To ensure full compatibility and smooth operation, your server should meet these minimum requirements:
mod_expires, mod_deflate, and mod_headers).The plugin implements intelligent rate limiting and timeout configurations to prevent server overload:
🕐 Please wait a few seconds..., you've triggered rate limiting. This is normal and protects your server.This plugin requires the ability to write files to your wp-content/uploads/ directory. This is a standard WordPress capability, but if your server has non-standard or overly restrictive permissions, you may encounter errors.
The plugin uses the WP_Filesystem API to safely read and write files. If you see an error like "Cannot initialize WP_Filesystem," it means your server is not configured to allow WordPress to manage its own files. You must contact your hosting provider to resolve this.
WordPress supports multiple methods for file operations. WP Optimal State PRO adapts its validation logic based on your server's configuration:
| Method | Description | Security Level |
|---|---|---|
direct |
PHP directly reads/writes files. Requires proper file ownership and permissions. | Highest - Plugin uses realpath() for canonical path validation |
ssh2 |
Uses SSH/SFTP connection. WordPress prompts for SSH credentials. | High |
ftpext |
Uses FTP extension (PHP 7.4+). WordPress prompts for FTP credentials. | Medium |
ftpsockets |
Pure PHP FTP implementation (fallback when ftpext unavailable). | Medium |
The plugin's path validation adjusts based on your FS_METHOD setting:
FS_METHOD is defined as 'direct' and the allowed directory already exists on disk (verified with file_exists()).
realpath() on the allowed directory to obtain its canonical (symlink-resolved, absolute) path. Returns false and rejects the request if resolution fails.realpath() on the target filepath only if that file already exists on disk. Files not yet created (e.g. a new backup about to be written) skip this second resolution but are still protected by the normalisation and boundary checks that run beforehand for all methods.../malicious/path resolves to its real location and fails the boundary check against the allowed directory.realpath() validation (SSH/FTP connections can't resolve server-side paths)../, no null bytes, must start with allowed directoryTo see which filesystem method WordPress is using:
wp-config.php for: define('FS_METHOD', 'value');For best performance and security with this plugin:
// In wp-config.php (if your hosting supports it)
define('FS_METHOD', 'direct');
To enable direct method safely:
www-data, apache, or nginx)755 for wp-content/uploads/644 for uploaded filesFS_METHOD isn't set to 'direct' or your file permissions are incorrect. Fix permissions first, then add define('FS_METHOD', 'direct'); to wp-config.php.
WP Optimal State PRO cannot be activated on WordPress Multisite (network) installations. If you attempt to activate it on a multisite network, you will see a clear error message and activation will be blocked.
This is a deliberate architectural decision, not a limitation to be worked around:
users, usermeta, sitemeta) across all sites. Cleanup operations on one subsite could delete data needed by other subsites.wp_, wp_2_, wp_3_, etc.). The plugin's table detection logic is designed for single-site prefixes and could misidentify tables.During activation, the plugin executes this check:
if (is_multisite()) {
deactivate_plugins(plugin_basename(__FILE__));
wp_die(
'WP Optimal State cannot be activated on WordPress Multisite installations.',
'Plugin Activation Blocked'
);
}
If you run a multisite network, consider these alternatives:
WP_Optimal_State_PRO_X-X-X.zip file from your computer and click Install Now.The upgrade process is straightforward. Simply replace the free version with the PRO version.
👉 Follow these quick steps:
.sql.gz files)..json settings file.WP_Optimal_State_PRO_X-X-X.zip containing the PRO version and click Install Now..json file you downloaded in step 2.💡 TROUBLESHOOTING: Functions Not Working After UpgradeIf after upgrading some functions don't work properly (e.g., save buttons not responding), this is usually caused by your browser still using cached versions of old JavaScript and CSS files.
Solution: Clear your browser cache
- Chrome/Edge: Press
Ctrl+Shift+Delete(Windows) orCmd+Shift+Delete(Mac), select "Cached images and files", then click "Clear data".- Firefox: Press
Ctrl+Shift+Delete(Windows) orCmd+Shift+Delete(Mac), select "Cache", then click "Clear Now".- Safari: Go to Safari menu → Settings → Privacy → "Manage Website Data" → "Remove All".
- Quick alternative: Try a hard refresh by pressing
Ctrl+F5(Windows) orCmd+Shift+R(Mac) while on the plugin page.
On activation, the plugin creates the following directories and database tables to ensure persistent operation and data integrity.
.../uploads/optistate-settings/
settings.json: Stores all your saved settings (schedule, backup limits, performance toggles).optimization-log.json: A log of all major operations (backups, restores, cleanups)..htaccess: A security file that blocks all direct web access to this directory..../uploads/optistate/db-backups/
.sql.gz backups..htaccess: A security file that blocks web access..../uploads/optistate/db-restore-temp/
.sql and .sql.gz files you upload for restoration. Files are scanned and deleted after use..htaccess: A security file that blocks all access..../uploads/optistate/page-cache/
.html files for the Server-Side Page Caching feature..htaccess: A security file that blocks web access to anything except .html files.wp_optistate_backup_metadata: Stores cryptographic checksums (SHA-256), file sizes, and timestamps for every backup. This allows the plugin to verify file integrity instantly without reading the entire file from disk.wp_optistate_processes: A specialized state-management table with three-tier caching:
wp_optistate_login_protect: Tracks failed login attempts by IP address for brute-force protection. Stores IP, timestamp, and attempt count with automatic cleanup of old entries.⚠️ WARNING - NGINX SERVERSIf your server is running Nginx, your site's sensitive directories are currently unprotected. The
.htaccessfiles this plugin relies on are ignored, leaving your files and settings exposed.To secure your server, you must manually add the security rules to your Nginx configuration. Read Section 7.3.1 for immediate instructions.
WP Optimal State PRO uses a sophisticated three-tier caching system for process state management:
wp_cache_set/get). Shared across PHP requests but cleared on server restart.wp_optistate_processes): Permanent storage for process data that survives server restarts. Created during activation with optimized indexes for fast lookups.When you access process data (like backup/restore status), the system:
The process store automatically purges expired entries in batches of 1,000 to prevent table bloat. Expiration times are set per-operation:
Your update process depends on whether you are using the FREE or PRO version. Please read the correct section for your plugin.
✔ UPDATING THE PREVIEW VERSION
If you installed the free preview/demo version of the plugin from the official WordPress plugin repository, you can update it directly from your WordPress dashboard.
⭐ UPDATING THE PRO OR FREE VERSION
Updating the PRO or FREE version (which you received as a .zip file) takes just a couple of minutes. You have two equally valid options.
💡 Option 1: Via the Dashboard
.sql.gz files)..json settings file..zip file containing the latest plugin release and click Install Now..json file you downloaded in step 2.👨💻 Option 2: Via FTP Client
.zip file on your computer to get a folder named optistate.wp-content/plugins/.optistate folder from your computer, choosing to replace or overwrite all existing files in the /wp-content/plugins/optistate/ directory.📥 How to Get PRO Updates
💡 TROUBLESHOOTING: Functions Not Working After UpdateIf after updating some functions don't work properly (e.g., save buttons not responding), this is usually caused by your browser still using cached versions of old JavaScript and CSS files.
Solution: Clear your browser cache
- Chrome/Edge: Press
Ctrl+Shift+Delete(Windows) orCmd+Shift+Delete(Mac), select "Cached images and files", then click "Clear data".- Firefox: Press
Ctrl+Shift+Delete(Windows) orCmd+Shift+Delete(Mac), select "Cache", then click "Clear Now".- Safari: Go to Safari menu → Settings → Privacy → "Manage Website Data" → "Remove All".
- Quick alternative: Try a hard refresh by pressing
Ctrl+F5(Windows) orCmd+Shift+R(Mac) while on the plugin page.
Understanding the deactivation cleanup process helps you make informed decisions about plugin management. The steps below reflect the actual execution order in the code.
When you deactivate WP Optimal State PRO, the following actions run in this sequence:
.htaccess.🔌 Plugin Deactivated by {username} entry is written to the activity log before any data is deleted, ensuring the event is always recorded.optistate_scheduled_cleanup, optistate_daily_cleanup, optistate_background_preload_batch, and optistate_run_rollback_cron..htaccess.optistate_maintenance_mode_active option is deleted to prevent the site being left in maintenance mode.wp_optistate_processes — the process-store table (dropped via its class method).wp_optistate_login_protect — the login-protection table (name validated against alphanumeric pattern before the drop is executed).wp_optistate_old_* or wp_optistate_temp_* — see the Stray Table Cleanup Logic subsection below._transient_optistate_* and their corresponding timeout keys _transient_timeout_optistate_* are deleted in a single query.optistate_ are deleted in batches of 100 to avoid memory issues on large databases.optistate_action_timestamps meta key is deleted from all user records.wp-content/uploads/optistate/page-cache/wp-content/uploads/optistate/db-restore-temp/Two directories survive deactivation on purpose, so that reactivating the plugin restores your previous state without data loss:
wp-content/uploads/optistate-settings/ — contains settings.json (your configuration) and optimization-log.json (your complete activity/audit history).wp-content/uploads/optistate/db-backups/ — all .sql.gz backup files are kept here. These are never touched by deactivation to prevent accidental data loss.To remove all traces of the plugin after deactivation:
wp-content/uploads/optistate-settings/ (settings and logs) and wp-content/uploads/optistate/db-backups/ (all backup files).wp-content/plugins/optistate/The deactivation process includes a dedicated routine to clean up tables left behind by interrupted or failed operations:
information_schema.TABLES for tables in the current database whose names match optistate_old_% or optistate_temp_%./^[a-zA-Z0-9_]+$/), no longer than 64 characters, and must start with the expected WordPress prefix (e.g. wp_optistate_old_ or wp_optistate_temp_). Tables that fail any check are skipped.SET FOREIGN_KEY_CHECKS = 0) for the duration of the drops to avoid constraint errors on interdependent tables.SET FOREIGN_KEY_CHECKS = 1).Because the settings and backup directories are preserved, reactivation is designed to be seamless:
settings.json file..htaccess.wp_optistate_processes and wp_optistate_login_protect tables are recreated with their indexes.The plugin dashboard is organized to guide you through a logical and safe workflow.
Section: 1. Create a Database Backup
Before you diagnose or fix anything, you must have an exit strategy. This section is your safety net. You can create a new, verifiable backup in seconds.
Sections: 3. Database Health Score, 4. Database Statistics, 6. Database Structure Analysis
You can't fix what you don't understand. These sections are your diagnostic tools.
Sections: 2. One-Click Optimization, 8. Detailed Cleanup, 9. Advanced Optimization, 10. Automation, 11. Performance
Once you have a backup and have diagnosed the problems, you can apply the solution.
This is the plugin's most critical feature. It allows you to create, manage, download, and restore your database with a focus on security and integrity.
The backup process relies on an asynchronous chunked engine that runs entirely in the background, making it resilient on any hosting environment — including shared hosting with low PHP time limits.
.sql and .sql.gz files are counted — internal SAFETY-RESTORE-* backups created during the restore process are explicitly excluded from this limit.
3. This keeps recent restore points available while minimizing server storage usage.
random_bytes(7)), making filename collisions statistically impossible. If a file at the target path already exists, the process throws an exception rather than overwriting..lock file is written with the current PHP process ID before any data is touched. If the lock cannot be created, the backup is aborted immediately. This prevents two concurrent backups from writing to the same file.SHOW FULL TABLES to enumerate every table, including its type (BASE TABLE vs. VIEW). Internal plugin tables (wp_optistate_processes, wp_optistate_backup_metadata, wp_optistate_login_protect, and any stray optistate_old_* tables) are silently excluded from the backup to avoid self-referential loops..sql.gz file opened in append mode (ab6f), meaning no full SQL file is ever held in memory. If PHP crashes mid-chunk, the partial gzip file is cleaned up on the next request.wp_optistate_backup_metadata database table. This is intentionally a database table, not a sidecar file — it cannot be tampered with by uploading a file to the backup directory.The backup mechanism is server-timeout proof using an asynchronous, chunked process. The plugin executes a series of timed AJAX requests, each running for a fixed window before saving state and yielding — ensuring reliability on any hosting environment including aggressively time-limited shared hosts.
active_worker slot in the process store with a unique worker ID and a worker_ping timestamp. If another process already holds the slot with a fresh ping (<45 seconds old), the new chunk exits immediately without touching the file. If the existing worker has gone stale, the slot is stolen and processing continues.shell_exec, PHP memory limit) and assigns a performance tier that controls how long each chunk runs and how quickly subsequent chunks are scheduled:
DROP TABLE IF EXISTS followed by the full SHOW CREATE TABLE output (or SHOW CREATE VIEW for views). The AUTO_INCREMENT value is read from SHOW TABLE STATUS and explicitly written into the CREATE statement, ensuring auto-increment counters are preserved exactly. Generated columns are detected and excluded from the column list to avoid restore errors.WHERE pk > last_seen LIMIT N. Zero drift, no performance degradation at scale.SHOW INDEX … WHERE Non_unique = 0 and uses the first numeric unique column for keyset pagination.LIMIT N OFFSET M, with batch size reduced to 65% of normal to compensate for offset overhead.AVG_ROW_LENGTH is fetched from information_schema (with SHOW TABLE STATUS as fallback) and cached in memory (up to 160 entries) and as a transient (10-minute TTL). The batch limit is calculated as floor(2MB / avg_row_length), clamped between 10 and 2,000 rows. Rows are buffered in memory up to 2MB, then flushed as a single INSERT INTO … VALUES (…),(…) block directly into the gzip stream. Oversized single rows that exceed the 2MB buffer are flushed individually. Memory usage is monitored every 1,000 rows — if usage exceeds 80% of the PHP memory limit, gc_collect_cycles() is called and the buffer is flushed immediately.
START TRANSACTION … COMMIT. This ensures the file is importable by phpMyAdmin, MySQL CLI, or any standard SQL tool without modification.wp_optistate_backup_metadata table alongside the filename, file size, database name, and creation timestamp.gzopen/gzwrite (level 6 by default). On servers where pigz (parallel gzip) is available and shell_exec is enabled, the decompression step during restore uses pigz for multi-core performance — backup creation always uses the streaming PHP path for safety.For large databases (500MB+), backup/restore operations may exceed the standard connection lifecycle limits. The plugin automatically handles this:
wait_timeout disconnectionsSELECT 1 heartbeat queriesSET SESSION time_zoneSET SESSION sql_mode='NO_ENGINE_SUBSTITUTION'SET SESSION wait_timeout=300Database tables with foreign key relationships require special handling during backup and restore operations.
What Are Foreign Keys? Constraints that enforce relationships between tables (e.g., wp_postmeta.post_id must reference existing wp_posts.ID).
The Problem: During restore, you can't drop parent tables if child tables have foreign keys pointing to them, causing "Cannot add or update child row" errors.
The Solution: The plugin temporarily disables foreign key checks during operations:
SET FOREIGN_KEY_CHECKS = 0;
-- ... perform operations ...
SET FOREIGN_KEY_CHECKS = 1;
Safety Mechanisms:
FOREIGN_KEY_CHECKS = 1 (see Section 4.6.1)SET SESSION commands, affecting only this connection, not other usersSET FOREIGN_KEY_CHECKS = 1;
Common Plugins Using Foreign Keys: WooCommerce (orders), Advanced Custom Fields, BuddyPress, LearnDash
This table lists all available backups.
wp_optistate_backup_metadata table at the time of creation. The backup is 100% valid and safe to restore..sql.gz version of the file to your computer.
Restoring a database backup is the most critical operation the plugin performs. To guarantee zero data loss against server timeouts, crashes, or corrupted files, the restore is broken into four distinct phases — each resumable, each with its own safety gate.
🔐 Phase 1: Pre-Flight Validation & Safety Backup
GET_LOCK('optistate_master_restore_global', 5)). This prevents two concurrent restore operations from running simultaneously — even across different browser tabs or server requests. If the lock cannot be acquired within 5 seconds, the restore is refused with a clear error message. A PHP shutdown handler is registered to release this lock automatically if the process crashes.-- Database: dbname header comment. If the database name in the file does not match your current WordPress database name (compared with hash_equals() to prevent timing attacks), the restore is blocked immediately. This prevents accidentally restoring a backup from a different site.SAFETY-RESTORE-{date}.sql.gz backup of your current live database using the same chunked engine described in section 4.2. This backup is your guaranteed rollback point — if anything goes wrong during the restore, it will be used to recover your original data automatically.optistate_maintenance_mode_active option set to true). This blocks new front-end database writes while tables are being swapped. Maintenance mode is always deactivated — even if the restore fails — via the same shutdown handler that releases the advisory lock.⚙️ Phase 2: Staged Import to Temporary Tables
CREATE TABLE statement in the backup is rewritten on-the-fly by the SQL parser to target a shadow table instead of the live table. For example, wp_posts becomes optistate_temp_wp_posts_{hash}. Your live tables are never touched during the import phase.CREATE TABLE statement is parsed, the engine strips secondary indexes from the CREATE statement and stores the corresponding ALTER TABLE … ADD INDEX queries separately. The table is created with only its primary key, all data is inserted at full speed (no index maintenance overhead), and the indexes are built in a single pass after the data is loaded. This mirrors what professional database import tools like mysqldump --disable-keys achieve.SET NAMES header). A utf8mb4 backup into a utf8 database is blocked with a clear error: this would cause data corruption (emoji and 4-byte characters would be silently truncated). A utf8 backup into a utf8mb4 database is allowed and handled correctly.SET GLOBAL, SET USER, GTID_NEXT/GTID_PURGED, CREATE PROCEDURE/FUNCTION/TRIGGER/EVENT, CREATE DATABASE, USE dbname, and LOCK TABLES/UNLOCK TABLES. This ensures a maliciously crafted backup file cannot escalate privileges or alter server-level settings.SELECT 1 heartbeat. If the connection has gone stale (MySQL wait_timeout disconnection), the engine automatically reconnects, re-applies all session settings, and resumes without loss. If the statement that failed was an INSERT, the transaction is reopened and the statement is retried.🔍 Phase 3: Staged Table Verification
*_options, *_posts, and *_users were all created successfully (matched by suffix to support any non-standard table prefix).*_options table is checked for: a non-empty row count, the presence of the siteurl option, all four required columns (option_id, option_name, option_value, autoload), and an intact PRIMARY KEY. A backup that passes structure validation but has an empty or structurally invalid options table is rejected before the atomic swap.⚡ Phase 4: Atomic Swap & Instant Rollback Guarantee
RENAME TABLE statement that renames all live tables to optistate_old_* and all temporary tables to the live names simultaneously. MySQL guarantees this operation is atomic — either all renames succeed, or none do. There is no moment when your live tables are missing or partially replaced. Table names longer than 64 characters are automatically handled with a hash-based truncation strategy.live_table → optistate_old_table pairs to the process store. If anything fails after the swap — including a PHP fatal error, memory exhaustion, or server crash — a subsequent request can call perform_rollback() which executes a reverse atomic RENAME to restore the original tables. This rollback itself is wrapped in a transaction, so it either succeeds completely or leaves the optistate_old_* tables intact for manual recovery.optistate_old_* tables are dropped, the safety backup file is deleted (it's no longer needed), and maintenance mode is deactivated. wp_cache_flush() is called to ensure no stale object cache entries survive the restored data.This architecture means that at no point during a restore operation is your site left in an undefined state. Either you have your original data, the restored data, or (in the rare event of a catastrophic failure) an automatic revert to the safety backup created in Phase 1.
This feature is designed to upload a .sql or .sql.gz file. You can upload a compressed backup downloaded from this plugin or an export from phpMyAdmin.
🚨 WARNINGOnly upload
.sqlor.sql.gzfiles generated by WP Optimal State or phpMyAdmin. Uploading a random file or a backup from another plugin may damage your database structure. 🧩 phpMyAdmin Compatibility: To ensure 100% compatibility with WP Optimal State, uncheck theEnclose export in a transactionoption before performing exports.
🔄 Process:
.sql or .sql.gz file from your computer.When you upload a .sql or .sql.gz file, it undergoes a rigorous multi-step security scan before it is ever used. Every check that fails results in the uploaded file being deleted from the server immediately.
.sql or .sql.gz. The MIME type (e.g., text/plain, application/sql, application/gzip, application/x-gzip) is also verified independently to prevent file-type spoofing via renamed extensions.<?php, <?=eval(, system(, exec(, base64_decode-- Database: dbname comment (the standard phpMyAdmin export header). If found and the name does not match your current WordPress database name, the restore is blocked. The comparison uses hash_equals() (constant-time comparison) to prevent timing-based enumeration of your database name. A random microsleep of 3–18ms is also inserted at this check point to further frustrate automated probing.CREATE TABLE or INSERT INTO statements targeting tables with the core WordPress suffixes (_options, _posts, _users). A file that passes the MIME and size checks but contains no recognizable WordPress tables is rejected as "not a valid SQL database backup."
If any of these checks fail, the file is deleted from the server and the restore is aborted with a specific error message identifying which check failed.
wp_options.WP Optimal State PRO has a sophisticated emergency recovery system that activates during PHP shutdown to prevent database corruption.
When PHP shuts down unexpectedly, the emergency_cleanup() function executes:
$connection->ping() to verify if MySQL connection is still aliveFOREIGN_KEY_CHECKS and AUTOCOMMIT are set back to defaultsIf emergency cleanup runs, you'll find entries in your PHP error log (error_log file):
[03-Feb-2026 14:32:18 UTC] OPTISTATE DB EMERGENCY ERROR: Connection lost during transaction
[03-Feb-2026 14:32:18 UTC] OPTISTATE: Failed to reconnect during emergency cleanup: Too many connections
SET FOREIGN_KEY_CHECKS = 1; in phpMyAdminSET AUTOCOMMIT = 1; in phpMyAdminoptistate_temp_ or optistate_old_ and manually drop themTo minimize the chance of emergency cleanup activation:
max_execution_time to at least 300 seconds for large databasesmemory_limit is adequate (512MB minimum, 1GB recommended for databases over 500MB)This is the core optimization suite. These sections work together to help you diagnose and clean your database.
The Database Health Score is your central diagnostic hub—a comprehensive analysis that gives you a single number (0-100) representing your database's overall condition. This score is calculated by examining multiple aspects of your database and applying weighted penalties for issues that impact performance, cleanliness, and structural efficiency.
The plugin analyzes your database across three key categories, each with its own sub-score. These are then combined into a single Overall Score using a weighted formula:
Overall Score = (Performance × 40%) + (Cleanliness × 35%) + (Efficiency × 25%)
A sensitivity factor of 1.3× is then applied to penalties, making the score more responsive to issues that need attention.
⚡ Performance Score (40% weight)
Measures factors that directly impact your site's speed and response time. This category has the highest weight because performance issues directly affect user experience.
What's analyzed:
🧹 Cleanliness Score (35% weight)
Evaluates how much "junk" data is accumulating in your database. Clean databases are faster to query and backup.
What's analyzed:
🎯 Efficiency Score (25% weight)
Analyzes your database's structural health and optimization. This includes indexing efficiency and table management.
What's analyzed:
The most valuable part of the Health Score interface is the recommendations section. Based on the specific issues detected, the plugin provides prioritized, actionable suggestions with direct links to the tools you need.
Recommendations are prioritized by severity:
💡 PRO TIP: Regular MonitoringYour Health Score is cached for 12 hours to avoid unnecessary database queries. Click "⟲ Refresh" to force a new calculation after making changes.
Check your score weekly or after major content changes (like importing products, publishing many posts, or installing/uninstalling plugins) to catch issues early.
This is the raw data used to calculate your Health Score. It shows you exactly what was found in your database.
The "One-Click Optimization" is the heart of the plugin's ease-of-use philosophy. It is designed to be a "safe-by-default" maintenance routine that you can run without fear of breaking your site or losing important data.
Unlike aggressive cleaners that might empty your trash bin or delete comments you haven't reviewed yet, this process selectively targets only useless data that has no effect on your live content.
To clean these "Protected" items, use the Detailed Database Cleanup (Section 8).
When you click "🚀 Optimize Now", the plugin executes two distinct operations in sequence:
OPTIMIZE TABLE on your database. This reclaims the empty space ("overhead") left behind by the deleted data, physically shrinking your database size and speeding up read/write operations.
💡 Result: After completion, you will see a summary report of exactly how many items were removed and how much disk space was reclaimed.
This is the recommended action for most users after creating a backup.
The Legacy Plugin Data Scanner helps you find "ghost data" — database entries left behind by plugins and themes you've already removed. Many plugins don't clean up after themselves when uninstalled, leaving behind options, metadata, custom tables, and files that waste space and can slow down your site.
What It Actually Scans:
How Detection Works:
The scanner uses intelligent pattern matching:
yoast_, elementor_, woocommerce_)Risk Levels Explained:
How to Use the Scanner:
What Gets Displayed:
Each detected item shows:
Examples of Safe Deletions:
What Happens When You Delete:
wp_options, wp_postmeta, or drops the custom table entirelyTechnical Notes:
Located directly under the Database Health Score, this section offers four specialized cleanup tools that target specific areas of database bloat often missed by general cleaners. Each tool uses a multi-pass, JOIN-based approach to find orphaned data through actual referential checks — not just pattern matching.
wp_actionscheduler_actions, _logs, _claims, _groups). These tables grow rapidly on any site using WooCommerce, WP Mail SMTP, or similar plugins.
complete, failed, canceled) in 2,000-row batches. Then runs a second pass to remove orphaned log, claim, and group rows that point to deleted actions — using LEFT JOIN … IS NULL queries rather than guessing by name or ID range.max_execution_time limit and stops safely when nearing it, preserving all data processed so far._oembed_* rows from wp_postmeta (per-post embed cache) AND clears matching transient pairs (_transient_oembed_* + _transient_timeout_oembed_*) from wp_options. Most tools only clean one location, leaving the other behind.meta_id > last_id / option_id > last_id pagination so cleanup of tens of thousands of rows never stalls or drifts.wp_options and the native sessions table. Generic cleanup tools typically miss most of this data.
_transient_timeout_wc_* records whose stored timestamp is in the past, then deletes both the timeout record and its matching _transient_wc_* value in a single query._wc_session_expires_* + _wc_session_* records past their expiry timestamp.wp_woocommerce_sessions table exists, removes expired rows directly from it.category, post_tag, custom plugin taxonomies): Deleted using wp_delete_term() — the correct WordPress API call that fires all hooks, updates counts, and cleans relationships correctly.wp_delete_term() cannot process unknown taxonomies. Cleans term_relationships, term_taxonomy, terms, and termmeta in one pass. After cleanup, wp_update_term_count_now() is called on all remaining taxonomies to keep counts accurate.This section provides a button for every single item listed in the Database Statistics. It allows you to clean items one by one with full control.
⚠️ IMPORTANT: Safe vs. Unsafe (Review First)Most items are "safe" to clean. However, some items are marked with a ⚠️ Warning Icon. These are "unsafe" because they involve deleting data you might want to review first.
- ✅ Safe to Clean: * Post Revisions, Auto Drafts, Trashed Comments, Orphaned Meta (all types), Expired Transients, Duplicate Meta, Pingbacks, Trackbacks.
- ⚠️ Unsafe (Review First): *🗑️ Trashed Posts: This will permanently empty your posts trash bin. *💬 Spam Comments: This will permanently delete comments marked as spam. *⏳ Unapproved Comments: This will permanently delete all comments awaiting moderation. *💾 All Transients: This will clear all cached data, including non-expired. While generally safe, it can temporarily break parts of your site that rely on active cache.
Every cleanup operation in this section shares the same underlying architecture, which sets it apart from standard database plugins:
WHERE id > last_seen_id ORDER BY id ASC LIMIT N rather than LIMIT / OFFSET. This means the cleanup never loses rows or re-processes already-deleted data, even on tables with hundreds of thousands of rows.
START TRANSACTION … COMMIT. If anything fails mid-batch, the entire batch rolls back cleanly. There are no partial deletes or half-cleaned states.
wp_postmeta AND wp_term_relationships for the post IDs in each batch before deleting from wp_posts. Most other plugins skip this step, leaving thousands of orphaned meta rows behind after a revision cleanup.wp_commentmeta for all collected comment IDs, then the comments themselves, then postmeta, then term relationships, then the posts. A single trashed post cleanup can touch six tables correctly.LEFT JOIN … WHERE parent.id IS NULL queries to find records whose parent no longer exists. This finds orphans that were created by buggy plugins or direct SQL deletes — not just records from the WordPress trash.
m1 INNER JOIN m2 ON same parent + same key + same value WHERE m1.id > m2.id) to find exact duplicates across all four meta tables (post, comment, user, term). It always retains the record with the lowest ID (oldest), and deletes the newer duplicates.
max_execution_time and stops safely when approaching the limit, preserving all committed work. A 20ms micro-pause between batches prevents table lock contention on busy servers.
These are powerful tools for database maintenance. 💾 Always create a backup before using them.
OPTIMIZE TABLE on everything, this tool applies a different strategy per storage engine:
ALTER TABLE … ENGINE=InnoDB, ALGORITHM=INPLACE, LOCK=NONE first. This is an Online DDL operation — it defragments the table without any table lock, meaning your site remains fully readable and writable during the operation. Only if the server does not support online DDL does it fall back to standard OPTIMIZE TABLE.OPTIMIZE TABLE (the only available option for this engine).CHECK TABLE in batches of 20, identifies any tables with corruption or crash markers, then runs REPAIR TABLE on those specifically. A final optimization pass is also applied to all large tables (>1,000 rows) as part of the same workflow. If your site is experiencing strange database errors, run this.wp_options table, options marked autoload='yes' are loaded on every page request. If plugins store large data here (1MB+), it can severely slow your Time to First Byte (TTFB).autoload='no'. It uses a layered decision tree to determine what is safe to optimize:
active_plugins, siteurl, cron, rewrite_rules, widget_*, theme_mods_*) and known critical options from WooCommerce, Elementor, Yoast SEO, and Wordfence are always skipped.license, api_key, secret_key, or password is always skipped.settings, config, or options in their name are treated as plugin configurations and skipped unless they are very large._transient_, _oembed_, jetpack_sync_, wc_session_) are safe-listed at any size. Generic large options (>200KB) that don't match any settings pattern are optimized regardless.Inside section 9, under the Advanced tab, this tool provides a complete map of your database structure and allows you to remove unused tables.
wp_posts, wp_users) with descriptions of what they do.The MySQL Index Manager is a powerful diagnostic tool that analyzes your database for missing or redundant indexes. Unlike standard cleanup tools, this module uses Prefix-Matching Analysis to ensure your database structure is optimized for high-traffic environments and complex queries, such as those generated by WooCommerce.
wp_options (autoloaded settings), wp_postmeta (custom field lookups), wp_posts (content queries), wp_usermeta, wp_commentmeta, and wp_termmeta.wc_order_product_lookup to speed up sales analytics and reporting.(post_id) and Index B covers (post_id, meta_key), Index A is redundant because Index B can handle all queries that Index A would.INSERT or UPDATE, improving overall site responsiveness.UNIQUE index as redundant when the covering index is non-unique, preserving data integrity constraints even if the column overlap looks identical.information_schema.STATISTICS in a single query, then performs analysis in PHP — minimizing database load during the scan.Adding or removing indexes on large tables can be a risky operation on busy sites. The Index Manager handles this intelligently:
ALTER TABLE … ALGORITHM=INPLACE, LOCK=NONE. This is MySQL's online DDL mode — the table remains fully readable and writable during the entire index build. No downtime, no locked pages.ALTER TABLE.SHOW INDEX FROM table to confirm the index was actually added or removed — and marks the task as failed if the schema did not change as expected.⚠️ CAUTION: LARGE TABLESAdding or dropping indexes on tables with millions of rows can take several minutes. Thanks to Online DDL, your site remains accessible during the operation. However, it is still recommended to perform these operations during low-traffic periods on very large databases.
The Referential Integrity Scanner is a specialized sanitation tool designed to find "Zombie Data"—rows in your database that point to parent data that no longer exists.
post_id = 123) might remain forever. This scanner specifically hunts down these broken links.
wp_posts that have no parent post.term_taxonomy that refer to term definitions that no longer exist.post_ID that has been removed.#452: _edit_lock) so you can verify the data is truly junk.⚠️ SAFETY FIRSTWhile orphaned data is generally safe to remove (as it points to nothing), always create a database backup before running integrity fixes, just as you would with any database operation.
The Index Manager includes several important safeguards:
wp_, wp_custom_, or another variation.UNIQUE index or a PRIMARY KEY, even if it appears redundant, to preserve data integrity.Located in the "Advanced" tab, this professional-grade tool allows you to find and replace text strings across your entire database. It is essential for tasks like migrating domains (http → https), updating shortcodes, or fixing bulk content errors.
🚨 CRITICAL WARNINGThis is a destructive operation. Changes made here cannot be "undone" without restoring a backup.
💾 You must create a fresh database backup (Section 1) immediately before running this tool.
🌟 Key Features:
SHOW TABLES before executing — no user-supplied table name is ever directly interpolated into SQL.BINARY operators to find exact character-case matches. The regex replacement also switches to a non-insensitive pattern. Case sensitivity applies independently to both the scan and the replacement phases.\p{L} lookbehind/lookahead) rather than simple \b word boundaries, so it correctly handles accented characters and non-ASCII text. Searching for "test" finds "This is a test" but not "testing" or "latest".str_replace / str_ireplace for maximum speed. Matches text anywhere within strings — required for URL updates, path changes, or domain migrations.wp_options table is given special treatment. Two categories of options are handled differently:
active_plugins, wp_user_roles, cron, db_version, optistate_settings, and the plugin's own search-replace session transients.siteurl and home. These are applied only after all other tables complete successfully, minimizing the window of URL inconsistency on a running site.🛠️ How to Use:
http://old-site.com) and the text to replace it with (e.g., https://new-site.com).WHERE pk > last_seen LIMIT 300) so it is resumable and never re-processes already-updated rows. Each batch of 300 rows is wrapped in a START TRANSACTION … COMMIT block. A failed batch triggers a ROLLBACK and logs the error — subsequent tables continue processing.Goal: Update all URLs from http:// to https://
| Search For: | http://yourdomain.com |
| Replace With: | https://yourdomain.com |
| Case Sensitive: | ❌ Unchecked |
| Partial Match: | ✅ Checked (Required for URL updates) |
⚠️ Important: Partial Match Mode is essential here. Without it, the tool would only match "http://yourdomain.com" as a standalone word, missing occurrences like "Visit http://yourdomain.com/page" or links embedded in content.
Goal: Change all references from old domain to new domain
| Search For: | oldsite.com |
| Replace With: | newsite.com |
| Case Sensitive: | ❌ Unchecked |
| Partial Match: | ✅ Checked |
Goal: Replace a specific word across all posts without affecting similar words
| Search For: | test |
| Replace With: | exam |
| Case Sensitive: | ❌ Unchecked |
| Partial Match: | ❌ Unchecked |
ℹ️ Result: With Partial Match unchecked, "This is a test." will become "This is an exam." but "testing" and "latest" will remain unchanged.
Goal: Fix incorrect capitalization of a brand name
| Search For: | iPhone |
| Replace With: | iPhone Pro |
| Case Sensitive: | ✅ Checked |
| Partial Match: | ❌ Unchecked |
ℹ️ Result: Only "iPhone" (exact case) will be replaced. "iphone" or "IPHONE" will be ignored.
| Scenario | Partial Match OFF | Partial Match ON |
|---|---|---|
| Search: "test" |
✅ "This is a test." ❌ "testing" ❌ "latest" |
✅ "This is a test." ✅ "testing" ✅ "latest" |
| Search: "http://" |
❌ "http://example.com" (No matches - needs word boundaries) |
✅ "http://example.com" ✅ "Visit http://site.com" ✅ All URL occurrences |
| Search: "Apple" (Case Sensitive ON) |
✅ "I like Apple." ❌ "apple" (wrong case) ❌ "Appleton" (not a word) |
✅ "I like Apple." ❌ "apple" (wrong case) ✅ "Appleton" (partial match) |
http://oldsite.com) rather than just oldsite to avoid unintended matches.This section provides a "set it and forget it" scheduler for all the tools you just learned about.
0 = ❌ Disabled1 = 📅 Daily7 = 📅 Weekly30 = 📅 MonthlyThe scheduler will run in one of two modes, depending on your settings: *backup & cleanup* or *backup only*:
This is a key "pro" feature.
This scheduler uses the built-in WordPress Cron system (wp_schedule_single_event). This is not a "true" cron job, which means it relies on someone visiting your website to trigger the schedule.
If you set a schedule for 3:00 AM, the tasks will run on the first site visit that occurs at or after 3:00 AM. For most sites, this is perfectly reliable.
This is a complete, standalone performance suite.
🚨 WARNINGThe Server-Side Page Caching and Browser Caching features in this section will conflict with other caching plugins like WP Rocket, LiteSpeed Cache, W3 Total Cache, WP Super Cache, etc.
🤔 You must choose ONE.
If you are already using another caching plugin, 🚫 DO NOT enable "Server-Side Page Caching" or "Browser Caching" in WP Optimal State PRO. You can, however, still use all the "WordPress Core Optimizations" (Section 7.4).
This is the single most effective way to speed up your site. It converts heavy PHP processing into instant static HTML. When a visitor requests a page, a lightweight cached file is served directly, bypassing slow PHP and database queries. For example, after enabling this, viewing your homepage for the second time will load instantly from a pre-generated HTML file instead of rebuilding the page from scratch. Combine this with browser caching for ultimate performance.
wp-content/uploads/optistate/page-cache/. Subsequent visitors get this file instantly, bypassing WordPress entirely.woocommerce_items_in_cart, edd_items_in_cart, etc.).utm_*, fbclid, gclid, msclkid, mc_cid, mc_eid, _ga, ref, source.?s=), 404 Error pages, Password-protected posts, and the Theme Customizer..html files in the cache directory.sitemap.xml (detects from robots.txt or standard paths) and simulates a visit to every URL to generate the cache file.example.com/page?ref=twitter serves the exact same file as example.com/page. (Fastest).page, paged, s, lang, sort, orderby, replytocom, view, amp, product_cat, product_tag, product-page, brand, eventDisplay, eventDate, forum-page.
/my-account/* or /forum/). Supports wildcards (*).-mobile.html cache file for mobile User-Agents. Enable ONLY if your site serves different HTML/Layouts to mobile devices (rare in modern responsive themes).my_custom_consent). When this cookie is detected, the system will automatically serve cached pages to the user.🔍 How to Verify Caching is Working:After enabling page caching, you can easily confirm it's working by checking the page source:
If you see this comment: ✅ The page was served from the static cache — your site is now delivering lightning-fast performance!
- Visit any page on your site (while logged out or in a private/incognito window).
- Right-click anywhere on the page and select "View Page Source" (or press Ctrl+U on Windows / Cmd+Option+U on Mac).
- Scroll all the way to the very bottom of the HTML source code.
- Look for this comment:
<!-- Cached by WP Optimal State Plugin -->
If you don't see it: The page was generated dynamically (this is normal for logged-in users, cart pages, or first visits before the cache is built).
This complements Server Caching. It tells a visitor's browser to save static files (like your logo, CSS, and JS) on their computer.
.htaccess file (this feature only works on Apache servers)..htaccess Writable Check: The plugin will check if it can write to this file. If this section shows a warning, you must fix your server's file permissions (usually 644) for .htaccess.mod_expires: Tells browsers how long to cache file types (e.g., "cache images for 1 year," "cache CSS for 1 month").mod_deflate / mod_brotli: Enables Gzip and Brotli compression, making your files smaller.mod_headers: Adds security headers (like X-Content-Type-Options, X-Frame-Options) to improve your site's security score.The following code block will be automatically added to the .htaccess file when this feature is activated:
ℹ️ IMPORTANT: Nginx UsersIf your server runs on Nginx instead of Apache, the Browser Caching (.htaccess) feature cannot be activated automatically because Nginx does not use .htaccess files.
All other plugin features work normally on Nginx servers, including:
- ✅ Database backup and restore
- ✅ Database cleanup and optimization
- ✅ Server-side page caching
- ✅ WordPress core optimizations
- ✅ Automatic scheduling
This section provides the configuration you need to manually add to your Nginx configuration file to enable browser caching and secure your plugin directories.
You need to add the configuration blocks below to your Nginx configuration file. This file is typically located at:
/etc/nginx/sites-available/your-domain.com (Debian/Ubuntu)/etc/nginx/conf.d/your-domain.conf (CentOS/RHEL)nginx.conf file⚠️ Important: Add these blocks inside your server { ... } block for your WordPress site.
Add this configuration to block direct access to sensitive plugin directories, such as database backups and your custom settings:
# ============================================================
# WP Optimal State - Directory Security (Nginx)
# ============================================================
# Block access to plugin settings directory
location ~* /wp-content/uploads/optistate-settings/ {
deny all;
return 403;
}
# Block access to database backup directory
location ~* /wp-content/uploads/optistate/db-backups/ {
deny all;
return 403;
}
# Block access to temp restore directory
location ~* /wp-content/uploads/optistate/db-restore-temp/ {
deny all;
return 403;
}
# Allow only .html files in cache directory, block everything else
location ~* /wp-content/uploads/optistate/page-cache/ {
location ~* \.html$ {
# Allow HTML files to be served
}
location ~* {
deny all;
return 403;
}
}
Add this configuration to enable browser caching for static assets and speed up site loading for returning visitors:
# ============================================================
# BEGIN WP Optimal State - Browser Caching (Nginx)
# ============================================================
# ------------------------------
# 0. Basic server tuning (safe defaults)
# ------------------------------
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
server_tokens off;
etag off;
# ------------------------------
# 1. Compression: Brotli (if compiled) + Gzip fallback
# ------------------------------
# Brotli (requires ngx_brotli)
brotli on;
brotli_comp_level 6;
brotli_types text/plain text/css application/javascript application/json application/xml application/rss+xml application/wasm image/svg+xml;
# Gzip fallback
gzip on;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_types text/plain text/css application/javascript application/x-javascript application/json application/xml application/rss+xml application/wasm image/svg+xml;
# ------------------------------
# 2. Security and common headers
# ------------------------------
add_header X-Content-Type-Options "nosniff" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
add_header X-Permitted-Cross-Domain-Policies "none" always;
add_header Permissions-Policy "camera=(), microphone=(), geolocation=(), payment=(), usb=(), gyroscope=(), accelerometer=(), magnetometer=(), ambient-light-sensor=(), fullscreen=(self)" always;
add_header Cross-Origin-Resource-Policy "same-site" always;
add_header Content-Security-Policy "frame-ancestors 'self'; object-src 'none'; base-uri 'self'; form-action 'self'" always;
add_header Vary "Accept-Encoding" always;
# HSTS only on HTTPS
if ($scheme = https) {
add_header Strict-Transport-Security "max-age=31536000" always;
}
# Hide PHP server header from upstream if possible
fastcgi_hide_header X-Powered-By;
# ------------------------------
# 3. Immutable static assets (1 year) — immutable for fingerprinted assets
# ------------------------------
location ~* \.(?:css|js|ico|jpg|jpeg|png|gif|webp|avif|svg|woff2|woff|ttf|eot|mp4|webm|mp3|ogg|aac|m4a|flac|wasm)$ {
expires 365d;
add_header Cache-Control "public, max-age=31536000, immutable" always;
access_log off;
log_not_found off;
try_files $uri =404;
}
# ------------------------------
# 4. Static HTML fallback (24 hours)
# ------------------------------
location ~* \.(?:html|htm)$ {
expires 24h;
add_header Cache-Control "public, max-age=86400, must-revalidate" always;
try_files $uri $uri/ =404;
}
# ------------------------------
# 5. PHP handling — let WordPress/plugins control PHP headers
# ------------------------------
location ~ \.php$ {
include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass unix:/run/php/php-fpm.sock;
fastcgi_read_timeout 300;
}
# ------------------------------
# 6. Login/admin and sensitive files — never cache
# ------------------------------
location = /wp-login.php {
add_header Cache-Control "no-cache, no-store, must-revalidate" always;
add_header Pragma "no-cache" always;
add_header Expires "0" always;
include fastcgi_params;
fastcgi_pass unix:/run/php/php-fpm.sock;
}
location ^~ /wp-admin/ {
add_header Cache-Control "no-cache, no-store, must-revalidate" always;
add_header Pragma "no-cache" always;
add_header Expires "0" always;
try_files $uri $uri/ /index.php?$args;
}
location ~* ^/(?:wp-config\.php|readme\.html|license\.txt|xmlrpc\.php)$ {
add_header Cache-Control "no-cache, no-store, must-revalidate" always;
add_header Pragma "no-cache" always;
add_header Expires "0" always;
deny all;
return 404;
}
# ------------------------------
# 7. Reduce logging for static assets
# ------------------------------
location ~* \.(?:css|js|jpg|jpeg|png|gif|webp|avif|svg|ico|woff|woff2|ttf|eot)$ {
access_log off;
log_not_found off;
}
# ============================================================
# END WP Optimal State - Browser Caching (Nginx)
# ============================================================
server { ... } block.sudo nginx -t
sudo systemctl reload nginx
⚠️ IMPORTANTIf you're not comfortable editing Nginx configuration files, please contact your hosting provider or system administrator for assistance. Incorrect Nginx configuration can cause your site to become inaccessible.
Always backup your configuration file before making changes.
After applying the configuration, you can verify it's working by:
Cache-Control and Expires headers.https://yoursite.com/wp-content/uploads/optistate-settings/ - you should get a 403 Forbidden error.This is a comprehensive suite of toggles and configurations designed to disable or optimize non-essential WordPress features that can slow down your site.
These are all safe to use alongside other third-party caching plugins.
.html files in the cache directory.sitemap.xml and simulates a visit to every URL to generate the cache file. Runs in background batches to prevent timeouts./my-account/* or /forum/). Supports wildcards (*).-mobile.html cache file for mobile User-Agents. Enable ONLY if your site serves different HTML/Layouts to mobile devices.my_custom_consent).mod_expires: Tells browsers how long to cache file types (e.g., "cache images for 1 year," "cache CSS for 1 month").mod_deflate / mod_brotli: Enables Gzip and Brotli compression, making your files smaller.mod_headers: Adds security headers (like X-Content-Type-Options, X-Frame-Options) to improve your site's security score.shop_order, ticket, product (Crucial for dynamic e-commerce operations).rel="preload" and media-switching techniques.fonts.gstatic.com, reducing DNS lookup latency by hundreds of milliseconds.loading="lazy" and decoding="async" attributes into images and iframes. This improves Core Web Vitals by deferring off-screen media until needed. For example, images at the bottom of a long blog post will only load when the user scrolls down to them, saving bandwidth and speeding up the initial page display.
loading="eager" and fetchpriority="high" to these critical elements to dramatically boost your Largest Contentful Paint (LCP) score, while safely lazy-loading the rest.
wp-config.php file, this control will be disabled.)wp-config.php file, this control will be disabled.)xmlrpc.php file will be completely blocked, reducing server load and improving security.
<link rel="https://api.w.org/" ...> tag from your site's header. For example, viewing your site's HTML source will no longer include the line <link rel='https://api.w.org/' href='https://yoursite.com/wp-json/' />. The REST API itself remains fully functional; only the auto-discovery header is removed. (Safe to activate).
<link rel='shortlink' ...> tag from your page headers. For example, a single post page will no longer output <link rel='shortlink' href='https://yoursite.com/?p=123' />. Shortlinks are rarely used, and removing them saves minimal bandwidth. (Safe to activate).
<link rel="EditURI" type="application/rsd+xml" title="RSD" href="https://yoursite.com/xmlrpc.php?rsd" /> will be removed from your site's header. If you don't use desktop software like Windows Live Writer to blog, this is safe to activate.
wlwmanifest.xml link tag, used by a discontinued Microsoft product. For example, the tag <link rel="wlwmanifest" type="application/wlwmanifest+xml" href="https://yoursite.com/wp-includes/wlwmanifest.xml" /> will be removed. This is completely safe as the software is no longer in use.
<meta name="generator" content="WordPress X.Y.Z" /> tag. This is a minor security improvement, as it hides your WordPress version from simple scanners. For example, automated bots scanning for vulnerable WordPress versions will not see your version number in the page source.
<link> tags are removed. For example, after activation, a request to https://yoursite.com/feed/ will still return your RSS feed, but the browser will no longer automatically discover it. (Safe to activate).
<link> tags (index, start, parent, prev, next) from page headers. These are navigation hints not used by modern browsers. For example, on a single post page, the link <link rel='prev' href='https://yoursite.com/previous-post/' /> will no longer be output. (Safe to activate).
The plugin implements multi-layer file path validation to prevent directory traversal attacks and unauthorized file access:
wp_normalize_path() to convert backslashes to forward slashes and resolve relative paths.wp-content/uploads/optistate-*).../ or ..\ (directory traversal)\0) - common in exploit attemptsFS_METHOD='direct'), the system resolves symlinks with realpath() and verifies the canonical path is still within allowed boundaries./uploads/optistate-data/../../../wp-config.php/wp-config.php, which fails the boundary check.
Settings containing potentially sensitive data are encrypted using AES-256-CBC:
AUTH_KEY constant hashed with SHA-256. If AUTH_KEY is unavailable, falls back to wp_salt().openssl_random_pseudo_bytes().enc: and base64-encoded with IV prepended to ciphertext.Currently, encryption is available via OPTISTATE_Utils::encrypt_data() for:
phpinfo() for OpenSSL support status.
Multiple layers protect against SQL injection attacks:
%s, %d, %i for identifiers)./^[a-zA-Z0-9_]+$/ (alphanumeric and underscore only).optistate_old_, optistate_temp_) before execution.%i placeholder), table names use identifier escaping. Otherwise, manual backtick escaping with double-backtick protection is applied.// Safe table name validation before dropping
if (!preg_match('/^[a-zA-Z0-9_]+$/', $table_name)) {
continue; // Skip invalid table names
}
if (strlen($table_name) > 64) {
continue; // Skip names exceeding MySQL limit
}
// Use WordPress's identifier placeholder if available
if (method_exists($wpdb, 'remove_placeholder_escape')) {
$wpdb->query($wpdb->prepare("DROP TABLE IF EXISTS %i", $table_name));
} else {
// Fallback: manual backtick escaping with protection
$safe_table_name = str_replace('`', '``', $table_name);
$wpdb->query("DROP TABLE IF EXISTS `{$safe_table_name}`");
}
Every AJAX request requires valid nonce verification:
OPTISTATE::NONCE_ACTION constant for verificationcheck_user_access() confirms administrator capabilitiesThe plugin includes a full brute-force protection system that tracks failed login attempts by IP address and blocks repeat offenders for a configurable period. It is designed to be both accurate and very fast — the critical path on login page loads is optimized to avoid database queries whenever possible.
HTTP_CF_CONNECTING_IP header instead of REMOTE_ADDR, but only if the request is arriving from a verified Cloudflare IP range (all 21 IPv4 and IPv6 Cloudflare CIDR ranges are built in and cached for one week).When a visitor hits the login page, the block check runs in this exact sequence, stopping at the first result to minimize overhead:
is_access_blocked() is called twice in the same request (once for login_init, once for authenticate), the second call returns instantly with no transient or database read.optistate_block_{ip_hash}. If the transient exists and its stored blocked_until timestamp is still in the future, the visitor is blocked immediately — no database query.optistate_clean_{ip_hash}. If this transient exists, the IP was recently confirmed as not blocked — return clean immediately. This 60-second clean cache eliminates database reads for legitimate repeated login attempts.wp_optistate_login_protect table. On a hit, the result is immediately cached back into the block transient for the duration of the remaining block period. On a miss (legitimate user), the clean transient is set for 60 seconds.When a login fails, the engine uses a single INSERT … ON DUPLICATE KEY UPDATE query to either create a new record or atomically increment the attempt counter for the existing IP. The block timestamp is set in the same query using an IF(attempts_count >= max, blocked_until, 0) expression — making the transition from "tracking" to "blocked" a single atomic SQL operation with no race condition. The user agent is also stored (truncated to 255 bytes, UTF-8 safe) for audit purposes. A successful login from the same IP immediately deletes its record and clears both transients.
The IP resolution logic correctly handles proxy chains:
REMOTE_ADDR directly.X-Forwarded-For chain from right to left and selects the first non-proxy IP as the real client address.HTTP_CF_CONNECTING_IP.::ffff:1.2.3.4 are automatically converted to their IPv4 form before storage and comparison.FILTER_VALIDATE_IP and stripped of any non-IP characters. If validation fails, it falls back to REMOTE_ADDR.Blocking applies to all three WordPress login surfaces simultaneously:
login_init (before the form renders) and authenticate filter (before credentials are verified). A blocked IP sees a custom 403 page instead of the login form — they cannot even attempt a password.The table is self-maintaining. A scheduled cleanup routine runs automatically and deletes: expired block records (blocks whose blocked_until timestamp has passed), and casual attempt records (IPs with no block that have had no activity in the last 24 hours). If more than 100 records are deleted in a single cleanup pass and the table has more than 1MB of overhead, OPTIMIZE TABLE is automatically run to reclaim space.
Attempt data is stored in a dedicated wp_optistate_login_protect table with a UNIQUE KEY on ip_address (enabling the atomic INSERT/UPDATE), and compound indexes on (blocked_until, updated_at) and updated_at for fast cleanup queries. The table is never included in plugin backups and is recreated automatically on plugin reactivation.
Located under the 'Statistics' tab in section 7, this module integrates the Google PageSpeed Insights API directly into your WordPress dashboard. It allows you to monitor real-world performance metrics without leaving the platform, focusing on the Core Web Vitals that impact your search engine rankings and user experience.
settings.json file.The plugin retrieves seven specific data points. The results are color-coded based on Google's official performance thresholds:
Logged Metrics Glossary:
Performance Audit Updated (Score% - Strategy). For example: ⚡ Performance Audit Updated (98% - Desktop).Not all traffic to your website is human or helpful. Resource-intensive bots—such as aggressive SEO crawlers, backlink analyzers, and competitive intelligence tools—can consume up to 40% of your server resources without providing any value to your business or visitors.
The Bad Bot Blocker targets specific categories of bots that consume resources without benefiting your website:
When enabled, the following bots are blocked by default. This list has been carefully curated to include only resource-intensive crawlers that provide no direct benefit to your website:
| Bot Name | Purpose | Impact |
|---|---|---|
| MJ12bot | Majestic SEO backlink crawler | HIGH |
| AhrefsBot | Ahrefs backlink database crawler | VERY HIGH |
| SemrushBot | Semrush SEO platform crawler | VERY HIGH |
| DotBot | Moz Link Explorer crawler | HIGH |
| PetalBot | Huawei Petal Search crawler | VERY HIGH |
| Bytespider | ByteDance/TikTok AI crawler | VERY HIGH |
| Mauibot | Unknown bot from AWS | MEDIUM |
| MegaIndex | Russian SEO backlink crawler | HIGH |
| SerpstatBot | Serpstat SEO platform crawler | HIGH |
| BLEXBot | WebMeUp backlink checker | HIGH |
| DataForSeoBot | DataForSEO API crawler | HIGH |
| AspiegelBot | SEO competitive analysis crawler | HIGH |
✅ Works on ALL web servers:
.htaccess rules (requires mod_setenvif and mod_authz_core)📊 Performance Difference:
✅ Recommended for:
⚠️ Consider disabling if:
💡 PRO TIP: Nginx UsersFor maximum performance, we recommend combining this feature with the Nginx security rules provided below. This allows your server to drop bad traffic at the web server level, before it even reaches PHP or WordPress—resulting in even greater resource savings.
🚀 Nginx Implementation Guide
If you are using an Nginx server, add the following block to your server configuration file (e.g.,
/etc/nginx/sites-available/your-domain.com) inside theserver { }block. This will block bots at the web server level for maximum efficiency:# WP-OPTIMAL-STATE: High-Performance Bot Blocking if ($http_user_agent ~* (MJ12bot|AhrefsBot|SemrushBot|DotBot|PetalBot|Bytespider|Mauibot|MegaIndex|SerpstatBot|BLEXBot|DataForSeoBot|AspiegelBot)) { return 403; }Important: After adding this configuration:
- Test your configuration:
nginx -t- If test passes, reload Nginx:
systemctl reload nginx- Monitor your server logs to ensure legitimate traffic isn't affected
Here are a few "recipes" for common scenarios.
(Assuming you already have the automatic schedule running).
This utility allows you to save all your plugin configurations to a single .json file. You can use this to create a backup of your settings or to quickly migrate your exact setup to another website. You can also restrict plugin access to specific administrator accounts.
🚨 IMPORTANT: What is NOT ExportedThis feature ONLY exports the plugin's settings, such as your configurations for scheduled tasks, performance features, and user access restrictions. It does NOT export your database backups, cached pages, or activity logs. Always download your database backups separately from Section 1.
optistate-settings-YYYY-MM-DD-His.json.This will completely overwrite all your current plugin settings. This is useful for restoring your configuration after an update (as described in Section 2.7) or for setting up a new site.
json file you previously exported..json file, under 1MB, and contain the "WP Optimal State" signature.Restrict plugin access to specific administrator accounts. If no users are selected, all administrators can use the plugin.
⚠️ WARNING: Lockout RiskDo not lock yourself out! Always include your own account in the allowed users list. If you save without selecting your account, you will be immediately locked out of the plugin.
How it works:
Configuration steps:
To restore full access:
Simply uncheck all user checkboxes and save. This removes all restrictions and allows all administrators to access the plugin again.
If you get locked out:
Brute force attacks—where automated bots attempt to guess your administrator password thousands of times per minute—are the most common threat to WordPress sites. This feature provides a robust, multi-layered defense to block these attackers before they can compromise your site.
✅ Key Benefits:
Cloudflare Compatibility Mode
If your site uses Cloudflare, standard security tools often see the Cloudflare Server IP instead of the Visitor's Real IP. This can lead to "False Positives" where you accidentally block Cloudflare itself, potentially breaking your site access.
☁️ Enable Cloudflare Support: When this is turned ON, the plugin ignores the standard remote address and instead looks for the HTTP_CF_CONNECTING_IP header. This ensures that the actual attacker is blocked, while Cloudflare's traffic remains safe.
⚠️ NOTICE: Only enable this if your site is actively routed through Cloudflare. Enabling it on a non-Cloudflare site may allow attackers to spoof their IP address.
The system is designed to be "self-healing." Blocked IPs are stored as Transients in your database, which automatically expire after your chosen Block Duration. If you accidentally block yourself:
💡 PRO TIP: Activity LoggingAll lockouts are recorded in the Activity Log. Periodically review your logs to see which IPs are being blocked. If you see persistent attacks from a specific range, you may want to block that entire country or range at the firewall level (Cloudflare WAF).
Ctrl+Shift+Delete (Windows) or Cmd+Shift+Delete (Mac), select "Cached images and files", then click "Clear data".Ctrl+Shift+Delete (Windows) or Cmd+Shift+Delete (Mac), select "Cache", then click "Clear Now".Ctrl+F5 (Windows) or Cmd+Shift+R (Mac) while on the plugin page.wp-content/uploads/optistate/db-backups/.SAFETY-RESTORE-....sql.gz that was just created. Download it.SAFETY-RESTORE-....sql.gz file you just downloaded and run the import..htaccess file..htaccess file in the root of your WordPress site. 3. Open and edit the file. 4. Find the block of text that starts with # BEGIN WP Optimal State Caching and ends with # END WP Optimal State Caching. 5. Delete that entire block of text and save the file. Your site will be back to normal.wp-content/uploads/ directory is not writable by WordPress. You must contact your hosting provider and ask them to fix the file/directory permissions for your uploads folder..htaccess file, manual configuration is required:
googleapis.com.This section documents the internal structure of the plugin: its security design principles, its PHP class layout, and its key configuration constants. All information here is drawn directly from the source code.
Every subsystem in the plugin was designed with security as a primary constraint, not an afterthought:
.htaccess and index.php files to block direct web access and PHP execution. The restore-temp directory is additionally restricted to 0750 permissions.eval(), system()) before processing.check_ajax_referer() and confirms administrator capabilities before executing.The plugin is organized into focused, single-responsibility classes. The main entry point bootstraps them via an SPL autoloader that maps class names to filenames automatically.
OPTISTATE — The main controller class. Handles WordPress hook registration, AJAX routing, performance-optimization logic, persistent settings I/O, and orchestrates all other classes.OPTISTATE_Backup_Manager — The central orchestrator for all backup and restore operations. Registers every AJAX and cron hook (backup creation, status polling, deletion, restore initiation, file upload, decompression, rollback), coordinates the backup engine and restore engine across multi-chunk background workers, enforces the configured backup retention limit, manages the backup metadata table (wp_optistate_backup_metadata), handles secure direct-download streaming with byte-range support, displays admin notices for directory permission warnings and rollback outcomes, and activates a 503 maintenance page for non-admin visitors during a restore.OPTISTATE_Backup_Engine — Executes the chunked SQL backup pipeline. Initiates a backup session by enumerating all non-excluded tables (storing state in OPTISTATE_Process_Store), then processes one time-bounded chunk per cron invocation: writing the phpMyAdmin-compatible gzip header, dumping table DDL (including DROP … IF EXISTS, CREATE TABLE, and AUTO_INCREMENT preservation), and streaming row data using keyset pagination (numeric primary key) or offset pagination as a fallback. Batch sizes are derived adaptively from AVG_ROW_LENGTH. Binary and spatial column values are hex-encoded. Supports concurrent-worker locking via an atomic worker_ping guard, automatic memory management via gc_collect_cycles(), and post-completion metadata persistence and backup-limit enforcement.OPTISTATE_Restore_Engine — Executes the chunked database restore pipeline. The master restore flow begins with a pre-restore safety backup, then decompresses the target file (with PIGZ/gzip CLI acceleration and PHP gzopen() fallback supporting resumable chunked decompression), validates the SQL file for database-name consistency and the presence of the three core WordPress tables, checks charset/collation compatibility (blocking UTF8MB4→UTF8 restores that would cause data loss), and streams statements through OPTISTATE_SQL_Parser for parsing. All DDL is redirected into optistate_temp_* staging tables; on success, a single atomic RENAME TABLE swaps them into production while the originals are kept as optistate_old_* for instant rollback. If any step fails, the rollback engine atomically reinstates the originals. Also manages MySQL advisory locks, maintenance mode, and post-restore cleanup of temp and stale tables.OPTISTATE_Backup_Utilities — A purely static utility library that supports the backup and restore pipeline across six areas:
cleanup_old_temp_files_daily()) — Removes stale files from the restore-temp directory (max age: 2 hours, extended to 7 days when a restore is active), drops orphaned optistate_old_* / optistate_temp_* tables with FOREIGN_KEY_CHECKS disabled, purges expired login-protection records, and clears any stale maintenance-mode flag.check_sufficient_disk_space()) — Applies a 5× decompression-expansion estimate for .gz files, requires 2.5× the estimated data size, and adds a hard 100 MB safety buffer (DISK_SAFETY_BUFFER_BYTES).verify_backup_file()) — Checks file existence, a minimum size of 100 bytes, a size match against the wp_optistate_backup_metadata record, and basic gzip readability via gzopen() / gzread().get_adaptive_worker_config()) — Scores available PHP memory, max_execution_time, and CPU core count (detected via nproc / wmic) to produce a three-value profile: chunks_per_run, reschedule_delay, and max_worker_time. Result is cached in a static variable for the request lifetime.format_row_for_sql(), get_statement_type(), validate_insert_column_list(), normalize_table_definition()) — Serialize database rows into safe SQL value tuples with binary/spatial column hex encoding and mysqli::real_escape_string(); classify SQL statements by leading keyword for restore-phase routing; validate INSERT column lists against an injection-keyword blocklist; normalize CREATE TABLE statements by collapsing whitespace and standardizing engine, charset, and collation attributes.cleanup_temp_files(), detect_backup_charset(), is_internal_backup(), get_gzip_path(), is_shell_exec_available()) — Delete temporary SQL files (optionally a single named file), detect charset and collation from a backup's header (plain or gzip), confirm whether a backup was produced by the plugin by scanning for its header comment, locate the system gzip binary with result cached in a transient for one month, and verify that shell_exec is available and unrestricted.OPTISTATE_SQL_Parser — A purely static SQL stream parser used by the restore engine. read_statement() reads a file handle (plain or gzip) chunk-by-chunk, strips SQL comments, handles custom DELIMITER directives, and correctly tokenizes quoted strings and block comments to locate statement boundaries — with a configurable memory-safety ceiling. rewrite_ddl() rewrites CREATE, DROP, and ALTER statements to target optistate_temp_* staging tables and resolves foreign-key references across the temp namespace. parse_create_table_for_indexes() splits non-essential indexes out of CREATE TABLE into deferred ALTER TABLE … ADD INDEX statements to avoid restore lock contention. fast_insert_rewrite() performs a regex-based table-name substitution on INSERT statements. split_and_retry_insert() re-executes oversized batched INSERT … VALUES one row at a time on packet-size errors. Additional helpers handle statement-type detection, DEFINER / CONSTRAINT stripping, charset normalization for MySQL 8.0 compatibility, and per-request parser memory optimization via gc_collect_cycles().OPTISTATE_Process_Store — Three-tier caching layer (runtime array → object cache → wp_optistate_processes table) that persists the state of long-running asynchronous tasks so they survive server timeouts between AJAX polling requests. Provides set(), get(), delete(), and an atomic_update() method that uses a SELECT … FOR UPDATE transaction to prevent race conditions during concurrent chunk workers.OPTISTATE_DB_Wrapper — A singleton mysqli wrapper used for raw database operations during restores. Separated from the global $wpdb for safety. Manages its own connection lifecycle with automatic refresh after 10,000 queries or 300 seconds, SSL support, session initialization commands, transaction and savepoint management, deadlock retry logic (errors 1213/1205), advisory-lock tracking with automatic release on close, and an emergency-cleanup shutdown handler that rolls back open transactions and releases locks on fatal errors.OPTISTATE_Admin_Interface — Renders the entire plugin admin panel, enqueues scripts and stylesheets, and passes configuration data to the front-end via wp_localize_script().OPTISTATE_Health_Score — Calculates the overall Database Health Score from three weighted sub-scores: Performance (40 %), Cleanliness (35 %), and Efficiency (25 %), with a 1.3× sensitivity amplifier applied to penalties. Results are cached in a transient and served from cache on subsequent requests; a force-refresh path (rate-limited to once per 6 seconds per user) clears the cache and recalculates from live statistics.OPTISTATE_Legacy_Scanner — Scans the live database and filesystem for data left behind by uninstalled plugins and themes. Builds in-memory prefix and slug lookup tables from a bundled data/legacy-map.php reference file (filterable via optistate_legacy_plugin_map) and cross-references them against the full list of currently installed and active plugins and themes. Scans post meta keys (top 250 by frequency), autoloaded options (top 250 by size), all database tables not belonging to WordPress core or installed software, and directories under wp-content/plugins, themes, mu-plugins, uploads, and wp-content root. Folder results include size, last-modified date, and a sensitive-file flag (raised for .sql, .env, .key, .log, and similar extensions). Risk levels range from low to critical. Deletion of identified items (post meta, options, tables, folders) is performed with transaction safety and post-deletion verification; folder deletion enforces a realpath()-based path-traversal guard. Folder index results are cached in a transient for one hour to avoid repeated filesystem walks. Execution time is bounded to 25 seconds per scan request.OPTISTATE_Server_Caching — Manages server-side page caching, including cache-file generation, automatic invalidation on content changes, background preloading, and consent-aware session validation.OPTISTATE_Advanced_Tools — Manages advanced structural database operations: table defragmentation (optimization and repair), autoload option optimization, MySQL index management, referential integrity scanning, and database structure analysis.OPTISTATE_Cleanup_Functions — Handles all garbage collection and safe sanitation routines. This includes executing the "One-Click Optimization", cleaning post revisions, auto-drafts, orphaned metadata, expired transients, WooCommerce bloat, and empty taxonomies using batched, timeout-safe queries.OPTISTATE_Login_Protection — Brute-force login defense. Tracks failed attempts in wp_optistate_login_protect and enforces configurable lockout durations, with optional Cloudflare IP-ban integration.OPTISTATE_Performance_Audit — Google PageSpeed Insights integration. Runs audits via the API, caches results, and presents recommendations on the dashboard.OPTISTATE_Search_Replace — Database search-and-replace engine with support for case-sensitive and regex modes, serialization-aware value updating, and dry-run previews.OPTISTATE_Utils — Shared static utility library. Key responsibilities include: file-path validation with a realpath()-based traversal guard (see Section 2.2.1); per-user per-action rate limiting via timestamped transients; AES-256-CBC encryption and decryption using AUTH_KEY / wp_salt() as the key source and a cryptographically secure random IV; server-type detection (nginx / apache / unknown); safe JSON file writes; recursive array key-sorting; Apache .htaccess rule generation and removal for bot blocking; WordPress header cleanup (REST API link, shortlink, RSD, wlwmanifest, generator tag); emoji script and style removal; XML-RPC disabling; self-pingback filtering; Google Fonts dequeue; and intelligent loading / decoding / fetchpriority attribute injection for images based on their position in the page.OPTISTATE_Activation — Handles the WordPress activation and deactivation hooks. On activation: blocks multisite installations with a clear error page, creates the wp_optistate_processes and login-protection tables, provisions the settings, backup, temp, and cache directories (with .htaccess and index.php hardening for the temp directory), writes default settings.json and optimization-log.json files if absent, re-applies any previously saved performance features, and seeds a default PageSpeed cache entry. On deactivation: removes all scheduled hooks, drops the process and login-protection tables, purges all plugin options and transients in batches, deletes the cache and temp directories, drops any stray optistate_old_* / optistate_temp_* tables, clears maintenance mode, and removes bot-blocking .htaccess rules (see Section 2.8).legacy-map.php (Data File) — A static PHP array file located in includes/data/ that serves as the reference database for the legacy scanner. Contains over 400 entries mapping plugin and theme identifiers (database prefixes, slugs, folder names) to their display names, risk levels (low, medium, high, critical), and types (plugin or theme). This map is loaded by OPTISTATE_Legacy_Scanner and can be extended via the optistate_legacy_plugin_map filter.admin.js (JavaScript) — Client-side logic: AJAX polling for backup/restore progress bars, chunked file uploads, nonce refresh, and all interactive dashboard behavior.admin.css (Stylesheet) — All visual styling for the plugin admin panel. Defines the layout grid, tab navigation, card and table components, color-coded health score rings, progress bars, status badges, info and warning boxes, the activity log, and responsive breakpoints. Loaded exclusively on the plugin's own admin page via conditional enqueue to avoid affecting other admin screens.The following constants are defined in the main OPTISTATE class and govern paths, cache durations, and other key behaviours across the plugin:
| Constant | Value | Purpose |
|---|---|---|
PLUGIN_NAME |
WP Optimal State (Pro) |
Display name used in notices and logs. |
VERSION |
1.3.1 |
Current plugin version. |
OPTION_NAME |
optistate_settings |
WordPress option key for in-database settings. |
NONCE_ACTION |
optistate_nonce |
Action string used for all AJAX nonce verification. |
STATS_TRANSIENT |
optistate_db_metrics_cache_v2 |
Transient key for cached database-statistics data. |
STATS_CACHE_DURATION |
12 hours | How long database statistics remain cached before a refresh is needed. |
SETTINGS_DIR_NAME |
optistate-settings |
Directory under uploads/ for settings and log files. Preserved on deactivation. |
BACKUP_DIR_NAME |
optistate/db-backups |
Directory for all .sql.gz backup files. Preserved on deactivation. |
TEMP_DIR_NAME |
optistate/db-restore-temp |
Temporary staging directory during restores. Deleted on deactivation. |
CACHE_DIR_NAME |
optistate/page-cache |
Directory for server-side page-cache files. Deleted on deactivation. |
SETTINGS_FILE_NAME |
settings.json |
Filename for the persistent settings file inside SETTINGS_DIR_NAME. |
LOG_FILE_NAME |
optimization-log.json |
Filename for the activity/audit log inside SETTINGS_DIR_NAME. |
GENERATED_SETTINGS_FILE_NAME |
generated-settings.php |
Auto-generated PHP settings cache for fast runtime reads. |
TRACKING_PARAMS |
13 parameters (see "Purpose" column) |
URL query parameters recognised as tracking/referral strings and stripped from page-cache keys. Includes utm_source, utm_medium, utm_campaign, utm_content, utm_term, fbclid, gclid, msclkid, mc_cid, mc_eid, _ga, ref, and source. |
The plugin implements multi-layer file path validation to prevent directory traversal attacks:
wp_normalize_path() to convert backslashes and resolve relative pathswp-content/uploads/optistate-*)../, ..\, and null bytes (\0)FS_METHOD='direct', resolves symlinks with realpath() and verifies canonical path/uploads/optistate-data/../../../wp-config.php/wp-config.php, fails boundary check
Multiple layers protect against SQL injection:
$wpdb->prepare() with proper placeholders/^[a-zA-Z0-9_]+$/, max 64 chars, expected prefixes only%i placeholder when available, otherwise manual backtick escapingSensitive settings are encrypted using AES-256-CBC:
AUTH_KEY constant (falls back to wp_salt())openssl_random_pseudo_bytes()enc: and base64-encodedEvery AJAX request requires:
check_ajax_referer()check_user_access() confirms administrator capabilitiesThis plugin provides powerful, low-level access to your WordPress database and server configuration. It is designed to be safe, secure, and effective. However, all servers and WordPress installations are different.
By using WP Optimal State PRO, you agree that you are doing so at your own risk. The author is not responsible for any data loss, site downtime, or other issues that may arise from the use or misuse of this software.
💾 Always create a backup before performing any optimization.
WP Optimal State PRO provides hooks for developers to extend functionality or integrate with other systems.
optistate_safe_query_params (array)optistate_optimization_completeoptistate_async_backup_complete$backup_filename as an argument.
As a lifetime licence holder, you are entitled to priority support.
Before using the support form, please get your license key and be sure to include it in your request along with your website URL.
Also, check the FAQs, as you may find the answer to your question there.