=== PhastPress ===
Tags: pagespeed insights, optimization, page speed, optimisation, speed, performance, load time, loadtime, images, css, webp, async, asynchronous, gtmetrix
Requires at least: 6.2
Requires PHP: 7.3
Stable tag: 3.6
Tested up to: 6.7
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' motto is _no configuration_. Install, activate and go!
PhastPress has the Phast web page optimisation engine by [Albert Peschar](https://kiboit.com/) and [Milko Kosturkov](https://twitter.com/mkosturkov) at its core.
**Image optimization:**
* Phast optimizes images using PNG quantization ([pngquant](https://pngquant.org/)) and JPEG recoding ([libjpeg-turbo](https://libjpeg-turbo.org/)).
* Phast inlines small images (< 512 bytes) in the page.
* Phast converts JPEG images into WebP for supporting browsers.
* Phast enables [native lazy loading](https://web.dev/native-lazy-loading/) to speed up page loading and save bandwidth.
**Asynchronous scripts and stylesheets:**
* Phast loads all scripts on your page asynchronously and in a single request, while maintaining full compatibility with legacy scripts, due to our custom script loader.
* Phast proxies external scripts to extend their cache lifetime.
* Phast inlines critical CSS automatically by comparing the rules in your stylesheets with the elements on your page.
* Phast loads non-critical CSS asynchronously and in a single request.
* Phast inlines Google Fonts CSS.
* Phast lazily loads IFrames to prioritize the main page load.
Get the full power of Phast for your website by installing PhastPress now.
[**For commercial support and bug reports, click here.**](https://kiboit.com/phastpress-support)
== 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, you may [request commercial support](https://kiboit.com/phastpress-support).
== 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.
I 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.
[Fast Velocity Minify](https://wordpress.org/plugins/fast-velocity-minify/) is not compatible with PhastPress, and causes PhastPress not to work. Please use either plugin, but not both.
= What about caching and compatibility with caching plugins? =
Caching means saving the HTML from the first visit to a page for later visits, so it does not have to be generated each time. Caching also helps performance with PhastPress, because the page needs to be optimized only once. It is recommendable to use a caching plugin with PhastPress.
PhastPress is not a caching plugin. I recommend using [WP Super Cache](https://wordpress.org/plugins/wp-super-cache/) in combination with PhastPress to speed up your server response time (TTFB).
In case you are using another caching plugin, please read the notes below:
**WP Fastest Cache**: Compatible with PhastPress, but non-caching optimizations must be **disabled**. Turn off the WP Fastest Cache options in [this screenshot](https://peschar.net/s/yQVWIuOuI4ThfRZfkKJa/).
**W3 Total Cache**: Compatible with PhastPress, but non-caching optimizations must be **disabled**. Specifically, the _Prevent caching of objects after settings change_ option causes problems.
**Cache Enabler** (by KeyCDN): Not compatible with PhastPress. Cached pages will not be optimized.
Generally, PhastPress should be compatible with other caching plugins as well. Some caching plugins include optimizations of JavaScript, CSS and/or images. I recommend turning off all optimizations to avoid conflicts with PhastPress.
= Is PhastPress compatible with Asset CleanUp: Page Speed Booster? =
Yes. The core functionality of Asset CleanUp: Page Speed Booster complements PhastPress by removing unused JavaScript and CSS from the page.
Do not use Asset CleanUp's features for optimizing CSS and JS. These features can cause conflicts with PhastPress, and they are not needed, because PhastPress already does this.
= 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".
= Why does PhastPress not impact the "Fully Loaded Time" measured by GTmetrix? =
The "Fully Loaded Time" in GTmetrix is the amount of time taken until all network activity ceases. This measurement can be misleading because it does not take into account the order in which resources load.
Normally, external resources such as scripts and stylesheets must be downloaded, parsed and executed before the page can be rendered. PhastPress changes this sequence by including all necessary resources (that is, the critical CSS) in the page, and executing scripts asynchronously, so that they do not block the rendering of the page.
This causes the page to be visible earlier in the browser, but does not change GTmetrix's fully loaded time.
In order to see this effect, register and log in to GTmetrix and enable the "Video" option. Then test your site (with Phast enabled), and use the "Compare" button to again test your site, but while appending "?phast=-phast" to the URL (eg, https://example.com/?phast=-phast). When the comparison loads, select the "Filmstrips" tab and you'll see the difference. The Phast-optimized version of your site should start rendering much earlier.
= 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:
If you (or a plugin) are using `wp_enqueue_script` to add the script to the page, you can use the `phast_no_defer` data key to stop PhastPress from processing the script:
wp_script_add_data('my_script_name', 'phast_no_defer', true);
Make sure this is run after registering the script. If you are trying to apply this to a script loaded by a plugin, you could use the `wp_print_scripts` hook:
add_action('wp_print_scripts', function () {
wp_script_add_data('my_script_name', 'phast_no_defer', true);
});
If you use the HTML source code to find the script name, note that `-js` and `-js-extra` are _not_ part of the name. For example, for a script like `