PhastPress

توسط

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 and Milko Kosturkov at its core.

Image optimization:

  • Phast optimizes images using PNG quantization (pngquant) and JPEG recoding (libjpeg-turbo).
  • Phast inlines small images (< 512 bytes) in the page.
  • Phast converts JPEG images into WebP for supporting browsers.
  • Phast enables 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.

  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.

سوالات متداول

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 only. This reduces the potential for plugin conflicts, and it is really all you need.

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 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.

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 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:

<script data-phast-no-defer>
// my script goes here
</script>

Or:

<script async data-phast-no-defer src="http://url.to.my.script/"></script>

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 <script id="jquery-core-js"> in the source code, the script name is jquery-core, and that is what you should pass to wp_script_add_data.

This is applied automatically for these scripts:

  • Google Analytics script inserted by Monsterinsights since PhastPress 1.29.
  • Tracking script inserted by Slimstat Analytics since PhastPress 1.30.
  • Google Analytics script inserted by Google Site Kit since PhastPress 1.75.
  • Google Analytics script inserted by GA Google Analytics since PhastPress 1.76.
Does PhastPress collect data or use external services?

Images are optimized using a free API, provided by the creator of PhastPress.

During image optimization, the following data is sent to the API:

  • the URL on which PhastPress is used
  • the version of the plugin
  • the PHP version (to track compatibility requirements)
  • the image itself

Images are sent to the API only once. Processed images are stored locally, and not retained by the API.

If image optimization is switched off, the API will not be used.

I get an error saying “Headers already sent”. How do I fix this?

Your theme or a plugin is trying to send HTTP headers after the page has started rendering and bytes have been sent to the browser. This is wrong, but it works when PHP output buffering is enabled.

PhastPress always sends output as soon as possible, to reduce the time to first byte. That means this problem cannot be fixed without slowing down sites without buggy themes/plugins.

To fix the problem on your site, the following code needs to be run in order to enable output buffering:

<?php
add_action('template_redirect', function () {
    ob_start();
});

You can add this code to your theme’s functions.php, or create a file output-buffer.php in wp-content/mu-plugins with the above code. You may have to create this directory first.

Alternatively, download output-buffer.zip and extract the contents into your web folder. You should end up with a file named output-buffer.php in wp-content/mu-plugins.

Can I optimize images without changing their URLs?

Yes. Add these two lines to your .htaccess file:

RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^wp-content/.*[^/].(jpe?g|gif|png)$ wp-content/plugins/phastpress/phast.php [L,NC,E=PHAST_SERVICE:images]

Then in PhastPress settings, disable image optimization in tags and CSS.

Now, reload your site and check if images are optimized.

Is it possible to use PhastPress with a CSP?

Yes, as long as you use a CSP with a script-src policy containing nonce-*. To enable Phast’s support for CSP implement the phastpress_csp_nonce filter:

<?php
add_filter('phastpress_csp_nonce', function () {
    return 'my-nonce';
});

Why do images not get converted to WebP when using Cloudflare?

Cloudflare does not support Vary: Accept, so sending WebP via Cloudflare can cause browsers that don’t support WebP to download the wrong image type. You can try using Cloudflare Polish instead.

تصویری برای این آیتم موجود نیست.
نظری برای این آیتم موجود نیست.
0 0 رای ها
امتیازدهی
اشتراک در
اطلاع از
0 نظرات
قدیمی‌ترین
تازه‌ترین بیشترین رأی
بازخورد (Feedback) های اینلاین
مشاهده همه دیدگاه ها
نسخه حجم فایل SHA256 تغییرات دانلود
3.9 363 کیلوبایت -
دانلود
×
★★★★★
★★★★★
4.9 /5 (99 نظر)

قیمت:

رایگان

نگارش

3.9

آخرین انتشار

10 اردیبهشت 1405

آخرین بروزرسانی

2 ماه پیش

نصب های فعال

10,000+

نگارش وردپرس

وردپرس 6.2+

تست شده از نسخه

وردپرس 6.8.5

نگارش PHP

PHP 7.3+

نسخه ها

1 نسخه