=== PhastPress === Tags: pagespeed insights, optimization, page speed, optimisation, speed, performance, load time, loadtime, images, css, webp, async, asynchronous, gtmetrix Requires at least: 4.4 Requires PHP: 5.6 Stable tag: trunk Tested up to: 5.3 License: AGPL-3.0 Contributors: apeschar PhastPress automatically optimizes your site for the best possible performance. == Description == PhastPress uses advanced techniques to manipulate your pages, scripts, stylesheets and images to significantly improve load times. It's designed to conform to Google PageSpeed Insights and GTmetrix recommendations and can improve your site's score dramatically. PhastPress has the Phast web page optimisation engine by [Kibo IT](https://kiboit.com/) at its core: * Phast optimizes images using PNG quantization and JPEG recoding, optionally through a free API. Small images are inlined into your page to save HTTP requests. * Phast loads all scripts on your page asynchronously, while maintaining full compatibility with legacy scripts, due to our custom script loader. External scripts are proxied to extend their cache lifetime. * Phast inlines critical CSS on the fly by comparing the rules in your stylesheets with the elements on your page. PhastPress also inlines Google Fonts CSS. * Phast bundles all CSS into a single file, which is loaded asynchronously. * Phast lazily loads IFrames to prioritize the main page load. Get the full power of Phast for your website by installing PhastPress now. **Experience any issues?** Please [contact me (Albert) on albert@peschar.net](mailto:albert@peschar.net). == Installation == 1. Upload the PhastPress plugin to your site and activate it. 2. Make sure that PhastPress is activated on the Settings page. 3. Test your site. If you experience any issues, please [contact me (Albert) on albert@peschar.net](mailto:albert@peschar.net). == Frequently Asked Questions == = Should I use other optimization plugins with PhastPress? = No. You do not need any other plugins, such as image optimization (e.g., Smush) or file minification (e.g., Autoptimize) after you install PhastPress, because PhastPress includes all necessary optimizations. We recommend using the simple combination of PhastPress and [WP Super Cache](https://wordpress.org/plugins/wp-super-cache/) only. This reduces the potential for plugin conflicts, and it is really all you need. = Is PhastPress a caching plugin? Do you recommend another caching plugin? = No, PhastPress does not do caching. We recommend using [WP Super Cache](https://wordpress.org/plugins/wp-super-cache/) in combination with PhastPress to speed up your server response time (TTFB). = Is PhastPress compatible with WP Fastest Cache? = Yes, but non-caching optimizations must be **disabled**. Turn off the WP Fastest Cache options in [this screenshot](https://peschar.net/s/yQVWIuOuI4ThfRZfkKJa/). = Is PhastPress compatible with W3 Total Cache? = Yes, but non-caching optimizations must be **disabled**. Specifically, the _Prevent caching of objects after settings change_ option causes problems. = Is PhastPress compatible with other caching plugins? = Yes. Some caching plugins include optimizations of JavaScript, CSS and/or images. We recommend turning off all optimizations to avoid conflicts with PhastPress. = PhastPress is enabled, but nothing happens = You might be using a plugin that compresses the page before PhastPress processes it. When that happens, PhastPress cannot apply optimizations. For example, if you are using the [Far Future Expiry Header](https://wordpress.org/plugins/far-future-expiry-header/) plugin, disable the option "Enable Gzip Compression". = Can I use a hook to disable PhastPress? = Should you need to disable PhastPress on certain pages, you can use the following code to do so: add_filter('phastpress_disable', '__return_true'); Make sure that this code runs during `template_redirect` or earlier. = Can I use disable PhastPress on WooCommerce checkout and cart pages? = Add this code to your theme's functions.php, or to a new file in wp-content/mu-plugins: add_filter('phastpress_disable', function ($disable) { return $disable || is_cart() || is_checkout(); }); = How and when does PhastPress clean the cache? = PhastPress uses filesize and modification time information to detect file changes, so clearing the cache is generally not needed. When you change a script or CSS file, the change should be visible immediately after reloading. If you do want to clear the cache, you can delete all the data inside `wp-content/cache/phastpress` or `wp-content/plugins/phastpress/cache`. = How do I exclude a specific script from optimization? = By default, PhastPress delays the load of all scripts until after the DOM has finished loading, so that the browser can render the page as quickly as possible. If you wish to load specific scripts as soon as possible, such as Google Analytics, you may add the `data-phast-no-defer` attribute to the script. It would be preferable to also mark external scripts as `async`, when possible. For example: Or: This is applied automatically for the Google Analytics script inserted by Monsterinsights since PhastPress 1.29. == Changelog == = 1.39 = Phast was updated to version 1.36: * Clean any existing output buffer, instead of flushing it, before starting Phast output buffer. = 1.38 = Phast was updated to version 1.35: * Use all service parameters for hash-based cache marker. This might fix some issues with stale stylesheets being used. = 1.37 = * The `phastpress_disable` hook is now triggered during `template_redirect` instead of `plugins_loaded`, which allows you to use many more functions in your hook handlers. Phast was updated to version 1.34. = 1.36 = Phast was updated to version 1.33: * Stop proxying dynamically inserted scripts after onload hits. * Combine the hash-based cache marker with the original modification time-based cache marker. * Remove comment tags (``) from inline scripts. * Send `Content-Length` header for images. = 1.35 = Phast was updated to version 1.31: * Change CSS cache marker when dependencies (eg, images) change. This prevents showing old images because CSS referencing an old optimized version is cached. = 1.34 = * Store service config in `service-config-*` files for AppArmor compatibility, if there's a rule that prevents writing `*.php` files. * Create index.html in cache directory to prevent path enumeration. = 1.33 = Phast was updated to version 1.29: * Trick mod_security into accepting script proxy requests by replacing `src=http://...` with `src=hxxp://...`. = 1.32 = Phast was updated to version 1.28: * Don't send WebP images via Cloudflare. Cloudflare [does not support `Vary: Accept`](https://serverfault.com/questions/780882/impossible-to-serve-webp-images-using-cloudflare), so sending WebP via Cloudflare can cause browsers that don't support WebP to download the wrong image type. [Use Cloudflare Polish instead.](https://support.cloudflare.com/hc/en-us/articles/360000607372-Using-Cloudflare-Polish-to-compress-images) = 1.31 = Phast was updated to version 1.26: * Keep `id` attributes on `style` elements. (This fixes compatibility with [css-element-queries](https://github.com/marcj/css-element-queries).) = 1.30 = * Don't delay SlimStats script. = 1.29 = * Don't delay Monsterinsights script so that Google Analytics works more reliably. Phast was updated to version 1.25: * Keep newlines when minifying HTML. = 1.28 = Phast was updated to version 1.24: * Send Content-Security-Policy and X-Content-Type-Options headers on resources to speculatively prevent any XSS attacks via MIME sniffing. = 1.27 = * Load configuration via `wp-load.php` instead of `wp-config.php`. = 1.26 = * Fix incompatibility with Thrive Architect. = 1.25 = * Test with WordPress 5.3. * Fix incompatibility with Divi Visual Builder. = 1.24 = Phast was updated to version 1.23: * Make CSS filters configurable using switches. = 1.23 = * Disable optimizations inside Yellow Pencil editor. = 1.22 = * Mitigate restrictive access rules for /wp-content by adding our own .htaccess for phast.php. * Try to put cache directory in wp-content/cache or wp-content/uploads before using the plugin directory. Phast was updated to version 1.22: * Remove empty media queries from optimize CSS. * Use token to refer to bundled resources, to shorten URL length. * Clean up server-side statistics. * Add HTML minification (whitespace removal). * Add inline JavaScript and JSON minification (whitespace removal). * Add a build system to generate a single PHP file with minified scripts. = 1.21 = Phast was updated to version 1.21: * Don't attempt to optimize CSS selectors containing parentheses, avoiding a bug removing applicable :not(.class) selectors. = 1.20 = * Fix compatibility issues by not prepending our autoloader. = 1.19 = Phast was updated to version 1.20: * Add *.typekit.net, stackpath.bootstrapcdn.com to CSS whitelist. * Don't apply rot13 on url-encoded characters. * Use valid value for script `type` to quiet W3C validator. = 1.18 = Phast was updated to version 1.18: * Don't rewrite page-relative fragment image URLs like `fill: url(#destination)`. = 1.17 = Phast was updated to version 1.17: * Restore `script` attributes in sorted order (that is, `src` before `type`) to stop Internet Explorer from running scripts twice when they have `src` and `type` set. = 1.16 = * Add `phastpress_disable` hook. = 1.15 = * Fix an issue whereby updating to 1.14 would reset the security token, invalidating links used in pages in a full-page cache. (To fix the issue, clear the cache of your full-page caching plugin.) = 1.14 = * Use the correct service URL when the site URL changes after activation. Phast was updated to version 1.16: * Encode bundler request query to avoid triggering adblockers. * Use a promise to delay bundler requests until the end of the event loop, rather than setTimeout. = 1.13 = Phast was updated to version 1.15: * Scripts can now be loaded via `document.write`. This restores normal browser behaviour. = 1.12 = Phast was updated to version 1.14: * `document.write` now immediately inserts the HTML into the page. This fixes compatibility with Google AdSense. = 1.11.0 = Phast was updated to version 1.13.1: * Remove query strings from URLs to stylesheets and scripts loaded from the local server. It is redundant, since we add the modification time to the URL ourselves. = 1.10.3 = * Add version information to console log. * Fix notice regarding undefined variable in settings panel. = 1.10.2 = Phast was updated to version 1.12.2: * Increase timeouts for API connection. = 1.10.1 = Phast was updated to version 1.12.1: * Don't use IndexedDB-backed cache on Safari. = 1.10.0 = * Use HTTPS for the API connection. Phast was updated to version 1.12.0: * Rewrite `data-lazy-src` and `data-lazy-srcset` on `img`, `source` tags for compatibility with lazy loading via [BJ Lazy Load](https://wordpress.org/plugins/bj-lazy-load/), possibly other plugins. = 1.9.0 = * Removed script rearrangement setting. Phast was updated to version 1.11.0: * Proxy CSS for maxcdn.bootstrapcdn.com, idangero.us, *.github.io. * Proxy icon fonts and other resources from fonts.googleapis.com. * Improve log messages from image filter. * Do not proxy maps.googleapis.com, to fix NotLoadingAPIFromGoogleMapError. * Removed `src` attribute from scripts that are loaded through the bundler, so that old versions of Firefox do not make extraneous downloads. * Check that the bundler returns the right amount of responses. * Per-script debugging message when executing scripts. * Animated GIFs are no longer processed, so that animation is preserved. = 1.8.5 = * Disable PhastPress for Elementor previews (edit mode). = 1.8.4 = * Fix installation notice dismissal. Phast was updated to version 1.9.3: * `