OptimizeSho

By ishayanabad

0+ active installationsVersion 2.0.2

Page cache, Core Web Vitals tools, firewall, wp2shell protection, Redis/Memcached object cache and database cleanup in one lightweight dashboard.

Description

OptimizeSho brings performance tuning, security hardening and maintenance tools together in a clean, developer-friendly dashboard. Every optimisation and protection feature is opt-in, uses WordPress APIs where they exist, and fails safe: when something cannot run safely, it simply steps aside.

After installation only the lightweight statistics are switched on (server performance sampling, Core Web Vitals from a share of visitors and the outgoing request log), so the dashboard has real numbers to show from day one. Nothing on your site changes until you enable a feature yourself, and each statistic can be turned off under Monitoring or Outgoing requests.

Performance

  • Page cache – static HTML served by an advanced-cache.php drop-in before WordPress loads: gzip copies, “304 Not Modified” (ETag revalidation), separate mobile cache, smart purging when content changes, background preloading, lifespan, URL/cookie exclusions, ignored tracking parameters and a “Clear cache” item in the admin bar. Logged-in users, carts, checkouts and searches are never cached.
  • Browser caching rules for Apache/LiteSpeed (.htaccess, between markers) and a ready-to-copy nginx snippet.
  • Delay JavaScript until the first interaction (or a timeout) – including inline scripts, in their original order, with DOMContentLoaded/load handlers still firing. Great for chat widgets, analytics and ads.
  • LCP and CLS helpers – fetchpriority=”high” for the LCP image, missing width/height for local images, a YouTube facade (lightweight preview until click) and lazy rendering of long sections with content-visibility.
  • Asset manager – scan any page to see every script and stylesheet with its plugin/theme and size, then unload it everywhere, on the front page, by URL or by post type. WooCommerce cart fragments and shop assets can be limited to shop pages.
  • Local Google Fonts – downloads the fonts your theme uses and serves them from your domain (no third-party connection for visitors), with font-display: swap.
  • Speculative loading control (WordPress 6.8+) – prefetch or prerender with your chosen eagerness; carts, checkouts and account pages are excluded.
  • Media – WebP or AVIF for generated image sizes (when the server supports it), compression quality and the big-image threshold. CDN URL rewriting for wp-content and wp-includes files.
  • Bloat removal – disable comments site-wide, RSS feeds, the front-end password strength meter and set the autosave interval.
  • Native script loading strategies – defer or async enqueued scripts through the WordPress 6.3+ strategy API, which keeps execution order correct automatically. Exclusion list included.
  • Smart lazy loading – adds loading="lazy" and decoding="async" with the WordPress HTML API, while keeping the first images (your LCP element) eager for better Core Web Vitals.
  • Resource hints & preload – preconnect/dns-prefetch for third-party origins of enqueued assets, plus your own preload URLs (LCP image, web fonts) with automatic as/type detection.
  • Safe minification – whitespace-aware HTML minifier that never merges words, string-aware inline CSS minifier and a conservative inline JS minifier that keeps // comments and semicolon-free code working.
  • Brotli compression – only when the response is not already compressed, no page cache or other output handler is active, and the browser accepts it.
  • Google Fonts removal, emoji/oEmbed/RSD/shortlink cleanup, Dashicons and block library CSS removal, jQuery Migrate removal, Heartbeat control, revision limits and local avatars instead of Gravatar.
  • Persistent object cache – a complete Redis / Memcached drop-in (TLS, unix sockets, Redis ACL, per-site prefixes, non-blocking prefix flush). Connection test before activation; falls back to a per-request cache if the server becomes unreachable.

Security

  • wp2shell protection – virtual patch for CVE-2026-63030 and CVE-2026-60137: blocks anonymous REST batch requests in every URL form, non-numeric author__not_in / author_exclude values and the public exploit tools.
  • Application firewall – context-aware signatures for XSS, SQL injection, code/command injection, path traversal, template injection, XXE and PHP object injection, designed for very low false positives. Passwords are never inspected and trusted editors are never scanned.
  • Trusted client IP detection – REMOTE_ADDR by default; Cloudflare, X-Forwarded-For, X-Real-IP or a custom header only from trusted proxies, so attackers cannot spoof their IP.
  • Rate limiting with HTTP 429 + Retry-After and automatic DNS verification of Googlebot, Bingbot and other search engines (no SEO impact).
  • Login protection – limits failed logins on wp-login.php, XML-RPC and application passwords; optional generic error messages.
  • Upload scanning – executable and double extensions, server config files, PHP code inside files and scripts inside SVG images.
  • Hardening – XML-RPC blocking, user enumeration protection (archives, REST, sitemaps, oEmbed), file editor lock, version hiding, security headers (CSP frame-ancestors, Permissions-Policy, COOP, optional HSTS) and REST API restrictions with a public-namespace allowlist.
  • Health check – flags known vulnerabilities in your WordPress, PHP (PHP2Shell) and nginx/Apache versions, PHP end-of-life, debug output and missing HTTPS, plus a read-only indicator-of-compromise scan.

Maintenance & monitoring

  • Dashboard charts – generation time, peak memory and SQL queries per hour or day, blocked requests per day by attack type, settings coverage, resource usage (memory, disk, CPU load, autoloaded options) – each chart has a table view and keyboard support.
  • Core Web Vitals from real visitors – LCP, INP, CLS, FCP and TTFB at the 75th percentile, measured by a 3 KB script on a sample of page views (10% by default, can be turned off under Monitoring) and stored on your site only.
  • Scheduled database cleanup (daily, weekly or monthly) and charts of the largest tables and autoloaded options.
  • WP-CLI – wp optimizesho cache|db|settings|firewall|fonts|metrics|health.
  • Database cleanup in time-limited batches: revisions, old auto-drafts, trash, spam, expired or all transients, orphaned meta and term relationships, oEmbed cache and OPTIMIZE TABLE only for tables with reclaimable space – limited to this site’s table prefix.
  • Outgoing request monitor – see which remote APIs slow down your site and block them by host, wildcard or URL prefix. Query strings are never logged.
  • Import / export (compatible with 1.x exports), reset and a copyable system report.

Developer friendly

Administrators can open any page with ?optimizesho_safe=1 to see it without OptimizeSho’s front-end optimisations. Add data-no-delay to a script tag to keep it out of “Delay JavaScript”, and data-no-facade to a YouTube iframe to keep the original player.

Filters include optimizesho_settings, optimizesho_cache_page, optimizesho_purge_post_urls, optimizesho_site_wide_post_types, optimizesho_delay_js_exclusions, the optimizesho_cache_purged action, optimizesho_client_ip, optimizesho_firewall_should_block, optimizesho_firewall_signatures, optimizesho_firewall_whitelist_paths, optimizesho_rest_public_namespaces, optimizesho_security_headers, optimizesho_script_strategy_exclusions, optimizesho_skip_output_buffer, optimizesho_brotli_quality and optimizesho_security_advisories.

Privacy

OptimizeSho does not send data to the plugin author or any analytics service and does not track users. All measurements stay in your WordPress database.

  • The firewall and login protection store blocked IP addresses, the request URI and User-Agent of blocked requests in your WordPress database (last 300 events, removed on uninstall). Mention this in your privacy policy if required in your jurisdiction.
  • The outgoing request log (on by default, can be turned off) stores endpoint URLs without query strings, call counts, durations and status codes – no request or response bodies.
  • Search engine verification performs reverse and forward DNS lookups of the requesting IP through your server’s DNS resolver.
  • “Replace Gravatar” stops requests to gravatar.com.
  • Server performance sampling (on by default, 10% of front-end page views) stores only aggregated hourly and daily numbers (time, memory, query count, cache hits) – no URLs, IP addresses or user data.
  • Core Web Vitals collection (on by default for 10% of page views, can be turned off under Monitoring): a 3 KB script sends timing values and a device class (mobile/desktop) to your site’s own REST API (/wp-json/optimizesho/v1/vitals). Nothing is sent to third parties. No cookies are set; no URL, IP address or identifier is stored. A hash of the IP address is kept for 10 minutes to rate-limit the endpoint. Logged-in editors are not measured.
  • The page cache stores public HTML pages on disk; pages for logged-in users, carts and checkouts are never stored.

External services

OptimizeSho connects to third-party services only for features you enable:

  • Google Fonts (fonts.googleapis.com, fonts.gstatic.com) – when “Host Google Fonts locally” is enabled, your server downloads the Google Fonts stylesheets and font files that your theme already loads, once, in a background task. Only the stylesheet URL and a browser User-Agent are sent; no visitor data. Afterwards visitors load the fonts from your own domain. Google Fonts privacy FAQ: https://developers.google.com/fonts/faq/privacy · Google Privacy Policy: https://policies.google.com/privacy · Google Terms of Service: https://policies.google.com/terms
  • YouTube (i.ytimg.com, youtube.com) – when the YouTube facade is enabled, visitors’ browsers load the video thumbnail from i.ytimg.com instead of the full player; the player (which you embedded) loads from youtube.com only after the visitor clicks. YouTube Terms of Service: https://www.youtube.com/t/terms · Google Privacy Policy: https://policies.google.com/privacy

The asset scanner and the cache preloader only request pages of your own site.

Third-party resources

  • IRANSansX font by Moslem Ebrahimi, published by Fontiran (https://fontiran.com) – proprietary font, not covered by the GPL; licensed for use inside this plugin only (license CRYADJUS, https://fontiran.com/license/CRYADJUS). Served locally from assets/fonts/iransansx on the settings screen only; see assets/fonts/iransansx/LICENSE.txt. It may not be reused outside OptimizeSho.
  • Cloudflare IP ranges (public list, https://www.cloudflare.com/ips/) are bundled for verifying CF-Connecting-IP.

Installation

  1. Install OptimizeSho from Plugins → Add New, or upload the optimizesho folder to /wp-content/plugins/.
  2. Activate the plugin.
  3. Open OptimizeSho in the admin menu. The Overview lists recommended settings you can enable with one click.
  4. If your site is behind Cloudflare, a CDN or a load balancer, open Firewall → Client IP detection and choose the matching source before enabling rate limiting.

FAQ

Will the firewall block my visitors or search engines?

The rules require attack-specific structures rather than single keywords, administrators are never blocked and editors are never content-scanned. Rate limiting only applies to anonymous visitors, answers with HTTP 429 (which search engines treat as “slow down”) and never limits verified search engine crawlers.

My site is behind Cloudflare / a CDN. What should I do?

Select the correct Client IP source in Firewall settings. Without it, every visitor appears to come from the proxy IP. OptimizeSho shows a warning when it detects forwarding headers.

Does wp2shell protection replace updating WordPress?

No. It is a virtual patch that blocks the known attack paths. Update WordPress to 6.9.5, 7.0.2 or later (6.8.6 for the 6.8 branch).

Can I use OptimizeSho with another caching plugin?

Use one page cache only. OptimizeSho never overwrites an advanced-cache.php or object-cache.php drop-in that belongs to another plugin and tells you when one is present. Avoid enabling the same optimisation twice (for example HTML minification or delayed JavaScript).

Does the page cache work on nginx, LiteSpeed and shared hosting?

Yes. Cached pages are served by PHP’s advanced-cache.php drop-in, so no server rules are needed. OptimizeSho adds define( 'WP_CACHE', true ); to wp-config.php (and removes it on deactivation); if wp-config.php is not writable, add the line yourself. Multisite networks are not supported by the page cache yet. On hosts that cache PHP files without checking for changes (opcache.validate_timestamps=0), enabling the cache with WP-CLI takes effect after PHP-FPM is reloaded; enabling it from the dashboard clears the cached wp-config.php automatically.

I changed the login address and forgot it.

Add define( 'OPTIMIZESHO_DISABLE_LOGIN_URL', true ); to wp-config.php, log in through wp-login.php and change or clear the slug. You can also run wp optimizesho settings set login_slug "".

Something looks broken after enabling an optimisation.

Open the page with ?optimizesho_safe=1 while logged in as an administrator to compare. Most issues come from “Delay JavaScript” or the asset manager: exclude the script (by keyword) or remove the rule.

How long may pages stay in the page cache?

Keep the lifespan at 12 hours or less when cached pages contain forms protected by WordPress nonces (contact, newsletter or comment forms of some plugins): a nonce stays valid for 12–24 hours, so older cached copies can show forms that fail. A lifespan of 0 never expires pages and is only suitable for sites without such forms.

Which scripts should be excluded from “Delay JavaScript”?

Scripts that must run before the visitor interacts – consent banners, A/B testing, above-the-fold sliders or menus. Also note that jQuery $(window).on('load') handlers registered by delayed scripts after the page has loaded do not fire; exclude those scripts by keyword.

Does “Disable comments” affect WooCommerce?

Yes. WooCommerce product reviews are WordPress comments, so they are hidden as well. Leave the option off on shops that use reviews.

Does Brotli work on every server?

It needs the brotli PHP extension. Server-level compression in nginx, Apache or your CDN is faster when available.

My site showed “There has been a critical error” after enabling the object cache of version 1.x.

The object cache drop-in of OptimizeSho 1.x stops WordPress with a fatal error as soon as it is installed. WordPress loads it before any plugin, so the dashboard, WP-Cron and automatic updates cannot run, and no new version can repair it by itself. Version 1.x also writes the file again on the next dashboard page, so deleting it and then updating from the dashboard does not work. While the file exists the dashboard cannot open at all, so every method below starts with access to the site’s files (FTP, your host’s file manager or SSH). Your settings and connection details are kept:

  1. FTP or your host’s file manager: replace the folder wp-content/plugins/optimizesho with the one from the 2.0.0 ZIP, then delete wp-content/object-cache.php.
  2. File manager, then dashboard: delete the folder wp-content/plugins/optimizesho and the file wp-content/object-cache.php, then install OptimizeSho under Plugins → Add New Plugin (search or Upload Plugin) and activate it. Activation turns the object cache back on after a successful connection test.
  3. WP-CLI: delete wp-content/object-cache.php, then run wp plugin update optimizesho.

After methods 1 and 3, turn the object cache back on under OptimizeSho → Object cache if it shows as disabled. If your host caches PHP code without checking for changed files, clear that cache (OPcache) or restart PHP in the hosting panel afterwards.

Is it safe to use a shared Redis or Memcached server?

WordPress caches whole PHP objects, so a cache server is trusted with data the site acts on. OptimizeSho stores every value with an integrity tag (a keyed MAC derived from the secret keys in wp-config.php and bound to the cache key); a value that was changed or planted on the server by anyone else, or copied from another key, is ignored and deleted before it is unserialized. On Memcached, items the attacker marks as PHP-serialized are still decoded by the php-memcached extension itself before any plugin code sees them (they are never used). Keep the server private either way: bind it to localhost, a unix socket or a private network, require a password (ideally a Redis ACL user per site), use TLS across networks and give every site its own key prefix or Redis database. Regenerating the wp-config.php salts empties the object cache once.

What happens when I deactivate the plugin?

The page cache and object cache drop-ins, the WP_CACHE line, cached pages, browser caching rules and scheduled tasks are removed, so nothing keeps running without the plugin. Settings are kept until you delete the plugin; deleting it also removes local fonts and collected metrics.

Screenshots

Changelog

2.0.2

  • Fixed: with “Block vulnerability scanners” on, WordPress cron started from a system crontab (php wp-cron.php) and other command-line scripts were answered with “Access denied”, so scheduled tasks did not run. Command-line runs are no longer inspected by the firewall; web requests are inspected as before.
  • Fixed: “Remove ?ver= from asset URLs” and “Hide WordPress version” now also apply to script modules (WordPress 6.5+, block themes and the Interactivity API), which could still show ?ver= with the WordPress version.
  • Fixed: “Remove HTML comments” kept theme comments that begin with “#” (such as <!-- #masthead -->). Only SSI directives (<!--#include …-->) are kept now.

2.0.1

  • Fixed: inline CSS minification could break other plugins’ inline scripts. When a script contained the text “
  • Settings screen: the font is now IRANSansX (licensed for this plugin), bundled locally as a single variable WOFF2 file. No font service is contacted. Vazirmatn is removed.

2.0.0

A complete rewrite focused on security, accuracy, Core Web Vitals and a new settings screen. Settings from 1.x migrate automatically. Requires WordPress 6.5 or later (1.x required 5.8). If your site is behind a CDN or proxy, review Firewall → Client IP detection after updating.

Performance

  • New: page cache with an advanced-cache.php drop-in – gzip copies, “304 Not Modified” revalidation, optional mobile variant, purging of the changed post and the pages that list it (also before a post is unpublished, trashed, deleted or renamed), a full purge when templates, template parts, global styles, menus or Elementor templates change, background preload, lifespan, URL/cookie exclusions, ignored tracking parameters and an admin bar purge. Logged-in users, carts, checkouts, searches and non-canonical addresses are never cached.
  • New: browser caching rules for .htaccess (Apache/LiteSpeed) and an nginx snippet.
  • New: delay JavaScript until interaction, LCP image prioritisation, missing image dimensions, YouTube facade (only https YouTube embed addresses are loaded) and lazy rendering (content-visibility).
  • New: asset manager with page scanner and per-page unloading rules; WooCommerce cart fragments and non-shop assets.
  • New: local Google Fonts and font-display: swap; speculative loading control (WordPress 6.8+); WebP/AVIF output, image quality, big image threshold and CDN URL rewriting.
  • New: disable comments, RSS feeds and the front-end password meter; autosave interval.
  • Rewritten: Redis/Memcached object cache drop-in with the full wp_cache_* API, TLS, unix sockets, Redis ACL, required per-site key prefix (a flush never empties a shared database), connection test, safe fallback, a one-time flush after an outage so changed data is never served stale, atomic increments and integrity-tagged values (data changed or planted on the cache server is never unserialized). This fixes the 1.x drop-in, which stopped WordPress with a fatal error once enabled (see the FAQ if your site is affected).
  • Removed: the 1.x switch “Load Elementor assets only on Elementor pages”. It had no effect, and Elementor already loads its front-end files only on pages that use them (checked with Elementor 4.3.5).
  • Improved: async/defer through the native WordPress strategy API, safe HTML/CSS/JS minification, Brotli only when safe, lazy loading that keeps the LCP image eager.

Security

  • Rewritten: wp2shell protection is now a targeted virtual patch for CVE-2026-63030 / CVE-2026-60137 at the firewall and REST layer. On sites updated from 1.x it is switched on automatically unless it had been switched off there.
  • Rewritten: context-aware application firewall (XSS, SQL, code/command injection, path traversal, XXE, object injection) with very low false positives; trusted users are never content-scanned.
  • New: trusted-proxy aware client IP detection with Cloudflare support, so attackers cannot spoof their IP.
  • Improved: rate limiting answers 429 + Retry-After and never limits verified search engines; new brute-force login protection and generic login errors.
  • New: custom login address with an emergency wp-config.php switch.
  • Improved: upload scanning; IPv6/CIDR allow and block lists with self-lockout prevention.
  • Improved: XML-RPC blocking, user enumeration protection, file editor lock, version hiding, security headers (CSP frame-ancestors, COOP, Permissions-Policy, optional HSTS) and REST API restrictions with a public namespace allowlist.
  • New: health check with WordPress, PHP, PHP end-of-life and nginx/Apache advisories, and an indicator-of-compromise scan.
  • Multisite: the object cache, .htaccess rules and cache flush can only be changed by network administrators; the page cache cannot be enabled on a network; database statistics and table optimisation stay within the current site.
  • wp-config.php is changed through a temporary file and an atomic rename, so a full disk cannot leave it truncated.

Maintenance & monitoring

  • New: dashboard charts for server performance, blocked requests by attack type, settings coverage and resource usage, each with a table view and keyboard support.
  • New: Core Web Vitals from a sample of real visitors (stored on your site only), largest tables, largest autoloaded options and slowest outgoing requests.
  • Light on the database: rate-limit and beacon counters live in the persistent object cache or APCu, otherwise one atomic database update per hit; at most 12 server metric samples are written per minute, and firewall counters are sampled during floods.
  • Improved: database cleanup in time-limited batches with a lock against parallel runs, a confirmation that lists every task and item count, and a schedule (daily, weekly or monthly). It only touches this site’s tables, keeps comment replies threaded, keeps relationships of user and other non-post taxonomies, and keeps global meta rows.
  • Rewritten: outgoing request monitor – one aggregated log per endpoint (query strings and credentials in URL paths are never stored) with blocking by host, wildcard or URL prefix. The per-URL logs of 1.x are removed.
  • New: WP-CLI commands, import/export (compatible with 1.x exports), reset and a system report.
  • New: suggested privacy policy text (Settings → Privacy → Policy Guide).
  • New installs start with every optimisation and protection feature off; only lightweight statistics are on.

Settings screen

  • New developer-tools dashboard: overview with hardening score, grouped navigation, settings search (Ctrl/Cmd + K), autosaving switches, light/dark/system appearance, a warning before leaving with unsaved changes and accessible controls (WCAG 2.1 AA colour contrast, keyboard support).
  • Full right-to-left support: layout, switches, tables, charts and mixed Persian/Latin text read correctly in RTL.
  • The bundled Dana font of 1.x is replaced by Vazirmatn (SIL Open Font License 1.1), used on the settings screen only.
  • Responsive layout for laptops, tablets and phones: slide-in navigation, stacked fields, scrollable tables and wrapping card headers.

1.0.0

  • Initial release on WordPress.org.