W3 Speedster
for Developers

W3 SPEEDSTER IS A FULL PAGE OPTIMIZATION PLUGIN FOR
WORDPRESS THAT CAN DRAMATICALLY SPEED UP WEBSITE.

Getting Started

Installing W3Speedster

There are two W3Speedster installation options: Automatic or Manual.

Download W3Speedster

Once you have bought W3Speedster, you can download the zip file from your W3Speedster account page.

Note: If you use Safari, it might be automatically unzipping the file on download. Either re-zip it, or follow instructions given below.

Disable Automatic Un-Zipping in Safari

If you want to use the Automatic Installation method for W3Speedster, ie. installing the plugin through your WordPress dashboard, you need to start with the zip file of the plugin. If you use Safari, it might be unzipping it for you which causes confusion.

Go to Safari > Preferences and un-check the box labeled ‘Open “safe” files after downloading’:

Now you can download the zip file normally and proceed with the installation.

Automatic Installation

Automatic installation is the easiest way to install W3Speedster.

To do it, log in to your WordPress admin panel and go to Plugin > Add New and click on Upload Plugin.

Select the zip file and click on Install Now. After clicking that link, you will be asked if you are sure you want to install the plugin. Click yes and WordPress will automatically complete the installation process.

Once it’s activated, simply go to the settings panel.

Manual Installation

The manual installation involves uploading all the files to your web server through FTP software.
Unzip the archive, then upload the ‘w3speedster’ folder to “wp content/plugins” directory.
Finally activate the plugin through your WordPress admin.

Once it’s activated, simply go to the settings panel.

Getting Started with W3Speedster

The first thing you’ll want to do once you’ve activated W3Speedster is:
Run an ON/OFF test with W3Speedster’s default settings, and see how much faster your site has become already!

You’ll be able to see the improvement in loading time W3Speedster has achieved just by running in its default configuration. If you have advanced knowledge about how the rendering of a website works in the browser, you can start to further optimize your setup based on recommendations from performance testing tools like GTmetrix, Pingdom Tools, or Google Developers PageSpeed Insights. If you find that your results vary with these tools then it is best to use one tool, consecutively test your website 3 times and take the average of the results.

Are there any recommended settings for W3Speedster?

There isn’t one recommended configuration of W3Speedster that can be used on every site. Themes, plugins, and hosting environments can vary greatly. Therefore, some settings will work differently on different websites.

There are even settings like File optimization that will work perfectly fine on one website, but won’t work at all on another. So sometimes leaving a setting entirely disabled can be your best bet! On the other hand, a number of key features—like CSS Minification, JS Minification, and WebP support are completely automated; you just have to check them and they’ll quietly work their magic under the hood and make your site faster without you having to move a finger.

Automated features

The following features are fully automated in W3Speedster:

  • Enabling WebP support
  • Image Quality control
  • Lazy Loading
  • CSS Minification
  • JS Minification
  • Combining of inline and 3rd party scripts
  • Combining Google Fonts

Settings panes

Looking for a specific setting? Here’s a quick overview of where’s what in W3Speedster:

‘General’ Tab
  • License Key
  • CDN URL
  • Lazy Loading
  • WebP Support
  • Image Quality Control
  • Excluded Pages
‘CSS’ Tab
  • CSS Minification
  • Other CSS Optimizations
  • Secondary CSS Optimization
  • Combine Google Fonts
‘JavaScript’ Tab
  • JavaScript Minification
  • Exclude JavaScript tags
  • Combine (concatenate) JavaScript
  • Delay JavaScript tags
  • Lazy Load JavaScript
  • Exclude JavaScript tags
Image Settings
  • Image Optimization
  • Image Size Adjustment

Updating W3Speedster

There are two ways to update W3Speedster: automatic and manual. Remember, if your license has expired, you can renew it on your account page.

Automatic update

Go to the Plugins page in the WordPress Dashboard (that’s {your site URL}/wp-admin/plugins.php)

Find the update notification below the W3Speedster entry, and click ‘Update Now’:

If you don’t see any update notification, you can try it a few hours later.

In your WordPress admin go to Dashboard > Updates and click ‘Check Again’. In some cases, this will cause the notice to appear.

If you still don’t see any update notification, your server may be blocking the requests to our update system, so you should use the manual update instead.

Manual Update

There are two possible ways to update W3Speedster manually.

Update via FTP
  1. Go to your account and download the latest version of W3Speedster
  2. Unzip the archive and then upload the ‘w3speedster’ folder to ‘wp-content/plugins’ directory
Update via WP Admin

Once you have downloaded W3Speedster from your account page, log in to WordPress Admin Dashboard of your website and follow these steps:

  1. Go to the Plugins page, deactivate and delete W3Speedster.
  2. Go to Plugins > Add new > Upload, upload the new .zip file, and activate your new W3Speedster version.

Update notification is missing

In some cases, you won’t see the update notification for W3Speedster in your WordPress admin panel at all. Luckily, there is a way to force the update notification of W3Speedster.

Visit the Plugins page in WordPress, and add the following query string to the end of the URL:

?w3speedup_force_update=1

So it looks like this, with example.com representing your domain here:

http://example.com/wp-admin/plugins.php?w3speedup_force_update=1

Scrolling down to the W3Speedster plugin entry, you should see an update notification now.

Can’t upload/install W3Speedster

Are you seeing this error message when you try to upload W3Speedster through your WordPress dashboard?

“The uploaded file exceeds the upload_max_filesize directive in php.ini.”

This message means there is a limit on the file size you can upload to your site. This limitation may be set at the site level or by your host. The W3Speedster zip file is just over 2MB so if the limit for your site is 2MB or less you would see this error message.

Quick Fix

To resolve it automatically, install the plugin Increase Max Upload Filesize: https://wordpress.org/plugins/upload-max-file-size/

If that plugin is not able to fix it automatically, you have the following options:

  • You can install W3Speedster by uploading it via FTP.
  • Contact your host to increase the upload limit.
  • Or, if you’re comfortable editing files you can follow the manual steps below to manually increase the upload limit.

Manual Fix

How to increase the upload_max_filesize limit

It’s possible to increase the defined limit by using one of the directives below. Depending on your server setup and host, the method that works could vary from case to case. You don’t have to edit all these files, just find the one that works for your site.

In each example below, “10M” represents a 10MB file size limit. You may set that number as you wish, but be sensible and don’t set it too high.

Make sure you take a backup of your files before editing them!

.htaccess
php_value upload_max_filesize 10M
php.ini file

If your host allows you to modify your site’s configuration with a custom php.ini file, you may use the following:

upload_max_filesize = 10M
wp-config.php
@ini_set(‘upload_max_size’ , ’10M’);
functions.php

If you use a child theme, you may add the following to the functions file:

@ini_set(‘upload_max_size’ , ’10M’);
Check your current upload limit

To verify if your attempt to increase the upload limit was successful you can check the current limit.

Go to: Media > Add New

Underneath the upload area, you will see: Maximum upload file size

After implementing one of the above methods, if the limit hasn’t changed it means your host is controlling this and you’ll have to contact them directly.

What exactly does W3Speedster do?

W3Speedster is a WordPress performance optimization plugin with many features:

  • CDN Integration
  • Optimize images
  • Lazy Loading
  • WebP Support
  • Minify CSS
  • Minify JavaScript
  • Defer parsing of JavaScript
  • Serve scaled images
  • Avoid CSS @import
  • Exclusions
  • Debug Site
  • Google Fonts Optimization
  • Delay JS

Uninstalling W3Speedster

W3Speedster can be uninstalled in two ways: from the plugins page in WordPress admin, and manually through FTP/File Manager.

From WordPress admin

You can uninstall W3Speedster as any other plugin from the WordPress admin Dashboard. W3Speedster will clean up after itself automatically, removing any files/folders and modifications (in the .htaccess or wp-config.php files for example).

Manually

If you manually remove W3Speedster from the plugins folder in /wp-content/plugins/, you will also have to handle the cleaning yourself. Here is a list of things to remove/edit:

  • Delete the /wp-content/cache/ and /wp-content/w3-speedster-config/ folders
  • Delete the /wp-content/advanced-cache.php file
  • Edit the .htaccess file, removing anything between #BEGIN W3SPEEDSTERand #END W3SPEEDSTER
  • Edit the wp-config.php file, setting the define(‘WP_CACHE’, true) to false or removing the line
  • Delete the w3speedster_settings entry, and the transients and cronjob in the WordPress options table of your Database

How to find the best settings for your site?

So, you’ve activated W3Speedster. And now you’re wondering, “How do I get the best results for my site?”

Every site has a different theme, a different set of plugins, and different content. So the best settings will vary from site to site. In this article, you’ll learn the safest way to experiment with the most commonly used W3Speedster settings.

The goal is always to make your site faster. And activating more options doesn’t always result in more speed. So don’t worry if you’re not able to turn everything on.

To check if your site is faster, you should use a tool that tests load times. You can make use of tools like GTmetrix, Pingdom Tools, or Google Developers PageSpeed Insights to test the load times of your website and get a detailed report.

It’s a good idea to take some benchmark speed tests before you begin configuration, then again after you’re done applying optimizations

Best practices for configuration

When testing options in W3Speedster, please use the following process:

  • Activate options one-at-a-time, not everything at once
  • After each option that you activate, check your site in a browser window where you are not logged in to WordPress. An incognito/private window works well. By doing this you will be able to see immediately if a particular option causes any issue.
  • Check a few types of pages on your site. If anything doesn’t look right, don’t panic! Disable the last option you activated and your site will return to normal.

Getting Started with Configuration

General > Image Optimization

You can enable Lazy Loading for images, I-frames, and videos. We recommend activating LazyLoad, because it helps reduce the negative performance impact of images, by loading them only when the visitor scrolls down the page and actually needs to see them.

You can also enable automatic optimization of images when uploaded and exclude images from optimization if you want to.

CSS > CSS Optimization

You can enable CSS Minification so that W3Speedster minifies your CSS files. You can set rules of minification and even exclude CSS files from this minification process. You can also select when to load secondary CSS and whether you want to delay it

Javascript > JS Optimization

You can enable JS Minification from this tab to instruct W3Speedster to minimize JavaScript files. You can also Defer Parsing of JavaScript in this tab and exclude JS from combining. You can also choose when you want to load combined JavaScript and how much time do you want to delay JS tags by.

GENERAL SETTINGS

 

1. LICENSE KEY:-

License Key is mandatory to insert to validate your licensed plugin access. Each license key is per product configuration. It is auto-generated when your plugin order is successfully completed.   Key is attached with the “Order Completed” email sent to you by W3Speedster.

2. TURN ON OPTIMIZATION:-

Among several other tasks, the W3Speedster Plugin mainly performs 4 tasks on your site, it enables the JS & CSS Minification, Generates Critical CSS, and converts all your images to WebP format without reducing the image quality. In order to enable all these, just turn on this field. However, you can individually adjust each of them (i.e, JS, CSS, image optimization) by changing their respective field settings.

3. OPTIMIZE PAGES WITH QUERY PARAMETER:-

This enables the optimization to be shown on the pages with query parameters  when the optimization is live. It is recommended only for servers with high performance.

4. OPTIMIZE PAGES WHEN USER IS LOGGED IN:-

It will optimize pages when a user is logged in. However please use this carefully.

5. SEPARATE JAVASCRIPT AND CSS CACHE FOR MOBILE:-

This will create separate Javascript and CSS cache for mobile i.e, separate  Critical CSS  for Mobile and desktop.

6. CDN URL:-

Enter the CDN url which you have bought for your site.

7. EXCLUDE FILE EXTENSIONS FROM CDN:-

During the implementation of the CDN, our plugin provides a section to exclude the specific extensions so that the work of the plugin is not hampered, for instance, excluding ‘Font Extensions’ like (.woff, .ttf, .eot, .woff2).

8. MINIFY HTML:-

W3speedster minifies HTML by reducing the size of the HTML files. This reduction reduces the loading time and increases site speed.

9. ENABLE LEVERAGE BROWSING CACHE:-

Our plugin also provides smart automatic functionality to enable leverage browser cache on your site, the plugin has an in-built response to the leverage cache, it automatically implements in your site.

10. ENABLE GZIP COMPRESSION:-

Our plugin also provides smart automatic functionality to enable Gzip Compression on your site, it automatically implements in your site. It will work only on apache server.

11. REMOVE QUERY PARAMETERS:-

Our plugin also provides smart automatic functionality to remove Query Parameters from CSS & JS on your site, it automatically gets implemented in your site.

12. ENABLE LAZY LOAD:-

The W3Speedster Plugin lazyload 4  resources which specifically delay the site loading time, our plugin will lazy load Images, Iframe, Videos and  Audio  on your site.

13. START LAZY LOAD IMAGES, VIDEOS, & IFRAMES PIXELS BELOW THE SCREEN:-

The W3Speedster Plugin keeps a standard 200 px below the viewport to start loading the images. However you can increase it so that images are loaded more quickly before coming to the viewport while scrolling.

14. ENABLE WEBP SUPPORT:-

The W3Speedster Plugin converts the image formats (.jpg & .png) into WebP format.

15. WEBP IMAGE QUALITY:-

The W3Speedster Plugin keeps a standard 90% quality to keep the quality of your images intact and unscrewed. However, you can change it according to your suitability.

16. OPTIMIZE JPG/PNG IMAGES:-

The W3Speedster Plugin optimizes all images (.jpg & .png).

17. OPTIMIZE IMAGES VIA WP-CRON:-

This enables the images to be  optimized  via wp-cron. Plugin optimizes one attachment every minute only to ensure server performance is not impacted. If you wish to optimize images faster then click the  start optimization button located in the ‘image optimization’ tab 

18. JPG & .PNG IMAGE QUALITY:-

The W3Speedster Plugin keeps a standard 90% quality to keep the quality of your images intact and unscrewed. However, you can change it according to your suitability.

19. OPTIMIZE IMAGES ON THE GO:-

The W3Speedster Plugin is so advanced that whenever you open a page on your site, it captures the unconverted and unoptimized images and then optimizes them in the background. This ensures that images which are used on the site are optimized first. However it is recommended to turn it off after a couple of days.

20. AUTOMATICALLY OPTIMIZE IMAGES ON UPLOAD:-

Whenever you upload media the W3Speedster Plugin automatically optimizes and converts the image formats into WebP format. The individual setting to optimize the images and convert it to webp should also be enabled.

21. RESPONSIVE  IMAGES:-

W3speedster makes responsive images. This will adjust the background image of the web page according to the different sizes of the screen of the users such as mobile, tablet, or desktop.

22. PRELOAD RESOURCES:-

If you wish to preload any resources like images, CSS, JS, and fonts all you gotta do is simply put your complete resource URL in the ‘Preload Resources Section’ and it will preload. Simple as it sounds. Enter each url in a separate line.

23. EXCLUDE IMAGES FROM LAZY LOADING:-

For all the images you do not wish to lazy load, all you gotta do is to simply exclude those particular images by putting the image URL, classname, Id, alt attribute etc (eg: xyz.png, nolazy).

24. EXCLUDE PAGES FROM OPTIMIZATION:-

For all the pages you do not wish to optimize, all you gotta do is simply exclude those particular pages by putting the page URL (eg: /cart, /login).

25. CACHE PATH:-

The cache of the W3Speedster Plugin is automatically generated inside  the cache folder of  WP Content Folder and if you wish to change the path you can change it by putting the full path in this section.

 

CSS OPTIMIZATION

 

1. ENABLE CSS MINIFICATION:-

The W3Speedster Plugin provides CSS Minification. Enable this box to start css minification.

2. LOAD CRITICAL CSS:-

The W3Speedster Plugin generates Critical CSS and loads  in .css file.

3. LOAD CRITICAL CSS IN STYLE TAG:-

The W3Speedster Plugin loads Critical CSS in style tag instead of css file.

4. CREATE CRITICAL CSS BUTTON:-

It will create critical CSS of your website. For that you have to crawl through  all the pages after that  clear all the wordpress cache including  server/CDN then click on the “Create Critical CSS Now”. 

5. EXCLUDE LINK TAG CSS FROM MINIFICATION:-

With the W3Speedster Plugin you can easily exclude CSS files for all the pages you do not wish to Lazyload and Minify by putting CSS URL (eg: xyz.css) in the relevant  section.

6. FORCE LAZYLOAD LINK TAG CSS:-

For all the files that consume excessive data, with the help of the W3Speedster Plugin you can easily Force Lazyload those files, for instance (FontAwesome.CSS or Icons.CSS).

7. COMBINE GOOGLE FONTS BY:-

The W3Speedster Plugin load & combine all google fonts which are loaded on your site.

8. DELAY GOOGLE FONTS BY:-

Lazy load google fonts by entering the seconds you want to delay the google font load.

9. LOAD STYLE TAG IN HEAD TO AVOID CLS

This enables style tags to load in the head and fix the CLS (Cumulative Layout Shift) of the page. Simply add the id of style tag in the given box and save changes. Make sure each style tag should be entered in the new line.

10. EXCLUDE PAGE FROM LOAD COMBINED CSS:-

Enter the url or part of the url where you don’t want to implement css optimization. Please enter each url or part of the url in a separate line.

11. CUSTOM CSS TO LOAD WITH PRELOAD CSS:-

If you wish to preload any CSS, add in this section without a style tag.

 

JAVASCRIPT OPTIMIZATION

 

1. ENABLE JS MINIFICATION:-

The W3Speedster Plugin provides JS Minification. Enable this box to start javascript minification.

2. EXCLUDE JAVASCRIPT TAGS FROM COMBINE:-

With the W3Speedster Plugin you can easily exclude JS files for all the pages you do not wish to Lazy Load and JS Minify by putting JS URL (eg: xyz.js) in the relevant  section.

3. PRELOAD CUSTOM JAVASCRIPT:-

If we wish to preload any script, add in this section without script tag.

4. EXCLUDE INLINE JAVASCRIPT FROM COMBINE:-

Enter the script or part of the script url to exclude it from optimization. If you wish to add defer attribute then add defer after a space. For eg. “jquery.min.js defer”. If you wish to not minify it then add full after a space. For eg. “jquery.min.js full”. Only one word after a space is allowed.

5. FORCE LAZY LOAD JAVASCRIPT:-

Put the specific word/ id  from inline script tag, script url or part of the script url to Force Lazy Load JavaScript which takes a lot of time to load (Eg. Facebook/Instagram) and reduces the score.

6. LOAD COMBINED JAVASCRIPT:-

Load the minified and combined js ‘on page load’ or ‘after page load’. Use after page load to score better on google page speed insights or other speed tools. However please use the ‘after page load’ option very carefully.

7. EXCLUDE PAGE FROM JAVASCRIPT OPTIMIZATION:-

With the W3Speedster Plugin, you can easily exclude pages from JS Minification that you do not wish to LazyLoad and JS Minify by putting a page script URL or part of the script URL. Please enter each script URL or part of the script URL in a separate line.

8. CUSTOM JAVASCRIPT:-

If we wish to load any script tag JS is added in this section without script tag which is loaded after page loads or on user interaction.

CACHE

 

1. DELETE JS/CSS CACHE

The plugin allows you to delete JavaScript and CSS combined and minified cache,  so if there are any changes in the themes or plugins files, they get refreshed.

2. DELETE CRITICAL CSS

The w3speedster WordPress plugin allows you to Delete critical CSS . Make sure to delete the  CSS only when you have made any changes to the style which is used in the upper half of the webpage. .

IMAGE OPTIMIZATION

Start image optimization by clicking on the start optimization button. The images will continue to get optimized in the background via wp-cron when the ‘optimize images via wp-cron option are enabled in the general settings.

Plugin Hooks

W3Speedster allow changes in code of the web page by just adding the required code in function.php in the theme file editor or through file manager.

change value of main variable

Function: W3speedup_customize_add_settings
Description: If you wish to change in variables and paths (URL), W3Speedster allows you to make changes in variables and paths with the help of this plugin function.
Parameter:
$settings- settings of the plugin.
Return:
$settings – reflect the changes made in variable and path.
Source:


function W3speedup_customize_add_settings($settings){
  $settings = str_replace(array(“mob.css”),array(“mobile.css”), $settings);
    return $settings;
}

DISABLE WEBP

Function:w3_disable_htaccess_wepb.
Description:Our plugin converts .jpg/.png format to WebP format without changing the URL. it disable webp to render from HTACCESS.
Return:
true – It will add w3.webp at the end of the url for instance (xyz.jpgw3.webp).
Source:



function w3_disable_htaccess_wepb(){
   return true;
}

CHANGE HTML OF PAGE BEFORE START OPTIMIZATION

Function: w3speedup_before_start_optimization
Description: W3Speedster allows you to make changes to the HTML on your site before actually starting the optimization. For instance replace or add in html.
Parameter:
$html – full html of the page.
Return:
true – Reflect the changes done in html of the page.
Source:



function w3speedup_before_start_optimization($html){
        $html = str_replace(array(""),array(""), $html);
    return $html;
} 

CHANGE HTML OF PAGE AFTER START OPTIMIZATION

Function: w3speedup_after_optimization
Description: W3Speedster allows you to make changes to the HTML on your site after the page is optimized by the plugin. For instance replace or add in html.
Parameter:
$html – full html of the page.
Return:
true – Reflect the changes done in html of the page.
Source:



function w3speedup_after_optimization($html){
   $html = str_replace(array(image.png''),array(image-100x100.png''), $html);
   return $html;
} 

EXCLUDE PAGES FROM GENERATING CRITICAL CSS

Function: w3_no_critical_css
Description: W3Speedster allows you to exclude the pages from the Critical CSS (like search pages).
Parameter:
$url- Stores the url of the page.
Return:
true – it will exclude the page you do not wish to create critical CSS.
Source:



Function w3_no_critical_css($url){
if(strpos($url,’/path/’) !==false) {
Return true;
}
}

EXCLUDE PAGES FROM OPTIMIZATION DYNAMICALLY

Function: W3speedup_exclude_page_optimization
Description: W3Speedster allows you to exclude the pages from the Optimization. if you wish to exclude your pages from optimization. (like cart/login pages).
Parameter:
$url- URL of the page.
Return:
true – it will exclude the page from optimization.
false – it will not exclude the page from optimization.
Source:



function w3speedup_exclude_page_optimization($url){
   if(!empty($_REQUEST['//Path//'])){
      return true;
   }
   return false;
}

EXCLUDE FROM GENERATING SRCSET

Function: w3_disable_srcset
Description: W3Speedster allows you to exclude generating srcset for the images. By default, if any image tag does not have a srcset, it adds a srcset to load a smaller image on mobile.
Return:
true – it will not generate srcset of the image.
Source:



function w3_disable_srcset{
   return true;
}

EXCLUDE IMAGE FROM LAZY LOAD DYNAMICALLY

Function: W3speedup_image_exclude_lazyload
Description: W3Speedster allows you to exclude the images from optimization dynamically which you don’t want to lazyload.
Parameter:
$path- Path of the image.
Return:
true – it will lazy load the image.
false – it will not lazy load the image.
Source:



function w3speedup_image_exclude_lazyload($path){
   if(!empty($path) && strpos($path,’logo.png’) !== false){
      return true;
   }
   return false;
}

TO CREATE SEPARATE CRITICAL FOR POST AND PAGE

Function: _create_separate_critical_css_of_post_type
Description: By default our plugin creates a single critical css for post but If you wish to generate separate critical CSS for post. W3Speedster allows you to create critical CSS separately post-wise.
Return:
array – create separate critical css for each post and page.
Source:



function w3_create_separate_critical_css_of_post_type(){
    return array('page','post','custom-post');
}

CATEGORIES TO CREATE SEPARATE CRITICAL CSS

Function: W3_create_separate_critical_css_of_category
Description: W3Speedster allows you to exclude the images from optimization dynamically which you don’t want to lazyload.
Parameter:
$path- Path of the image.
Return:
true – it will lazy load the image.
false – it will not lazy load the image.
Source:



function w3_create_separate_critical_css_of_category(){
   return array('category','tag','custom-category');
}

EXCLUDE JAVASCRIPT FILES FROM PLUGIN TO MAKE ANY CHANGES

Function: W3speedup_exclude_internal_js_w3_changes
Description: Our plugin makes changes in JavaScript files for optimization, if you do not want to make any changes in JavaScript file, W3Speedster allows you to exclude JavaScript files from the plugin to make any changes.
Parameter:
$path- Path of the JS file.
$script – javascript you want to make changes in.
Return:
$true – Exclude the JS file from making any changes.
$false – It will not exclude the JS file from making any changes.
Source:



function w3speedup_exclude_internal_js_w3_changes($path,$html){
   if(strpos($path,'//js path//') !== false){
      return true;
   }
   return false;
}

MAKE CHANGES IN JAVASCRIPT FILES

Function: W3speedup_internal_js_customize
Description: If you wish to make changes in JavaScript files, W3Speedster allows you to make changes in JavaScript Files.
Parameter:
$path- Path of the JS file.
$script – javascript you want to make changes in.
Return:
$script– make changes in the internal JS file.
Source:



    function w3speedup_internal_js_customize($script,$path){
        if(strpos($path,'//js path//') !== false){
          $script = str_replace("jQuery(windw)", "jQuery(window)",$script);
        }
        return $script;
     }

EXCLUDE JAVASCRIPT FROM MINIFY ONLY

Function: W3speedup_internal_js_minify
Description: If you wish to exclude any JavaScript file from minify, W3Speedster allows you to exclude JavaScript from minify only.
Parameter:
$path- Path of the JS file.
$script – javascript you want to make changes in.
Return:
true – it will exclude the js file from optimization.
false – it will not exclude the js file from optimization.
Source:



function w3speedup_internal_js_minify($path,$html){
   if(strpos($path,'//js path//') !== false){
      return false;
   }
   return true;
}

CUSTOMIZE SCRIPT OBJECT WHILE MINIFY AND COMBINE

Function: W3speedup_customize_script_object
Description: W3Speedster allows you to customize script objects while minifying and combining scripts.
Parameter:
$script_obj- Script in object format.
$script- Content of the JS file you want to make changes in.
Return:
$script_obj– Make changes in Js files.
Source:



    function w3speedup_customize_script_object($script_obj, $script){
        // your code
        return $script_obj;
        }
    
    

EXCLUDE JAVASCRIPT FILES FROM OPTIMIZATION DYNAMICALLY

Function: W3speedup_exclude_javascript_filter
Description: If you want to dynamically exclude a JavaScript file or inline script from optimization, W3Speedster allows you to exclude it from optimization (like revslider).
Parameter:
$exclude_js – boolean, whether it is excluded or not.
$script_obj – Script in object format.
$script – Content of the JS file you want to make changes in.
$html – content of the webpage.
Return:
$exclude_js – exclude JS from optimization.
Source:



    function w3speedup_exclude_javascript_filter($exclude_js,$script_obj,$script,$html){
        if(wp_is_mobile()){
            if(strpos($script,'jquery-core-js') !== false || strpos($script,'/revslider/') !== false){
                return 0;
            }
        }
        return $exclude_js;
    }

MAKE CHANGES IN EXTERNAL JAVASCRIPT URLS

Function: W3_external_javascript_customize
Description: If you want to make changes in your external JavaScript tags, W3Speedster allows you to make changes in external JavaScript tags.
Parameter:
$script_obj – Script in object format.
$script – Content of the JS file you want to make changes in.
Return:
$script_obj – Make changes in Js files from an external source.
Source:



    function w3_external_javascript_customize($script_obj, $script){
        if(strpos($script,'//text//') !== false){
          $script = str_replace(' ',' ',$script)
        }
        return $script_obj;
     }

MAKE CHANGES IN INLINE JAVASCRIPT SCRIPT TAGS

Function: W3speedup_inner_js_customize
Description: If you want to make changes in your inline JavaScript, W3Speedster allows you to make changes in Inline JavaScript (for instance making changes in inline script you have to enter the unique text from the script to identify the script).
Parameter:
$script- The content of the script.
Return:
$script – Content of the script after changes.
Source:



    function w3speedup_inner_js_customize($script){
        if(strpos($script'//unique word from script//') !== false){
           $script = str_replace(''jQuery(window) ', 'jQuery(document)',$script);
      }
        return $script;
     }

MAKE CHANGES IN STYLESHEET FILES

Function: W3speedup_internal_css_customize
Description: If you want to make changes in your CSS file, W3Speedster allows you to make changes in stylesheet files.
Parameter:
$css- Css content of the file.
$path- path of css file.
Return:
$css – make the required changes in CSS files.
Source:



    function w3speedup_internal_css_customize($css,$path){
        if(strpos($path,' //cssPath // ') !== false){
           $css = str_replace(' ',' ',$css);
        }
        return $css;
     }

EXCLUDE STYLESHEET FILES FROM MINIFY ONLY

Function: W3speedup_internal_css_minify
Description: If you don’t want to minify, W3Speedster allows you to exclude stylesheet files from minify.
Parameter:
$path- path of css file.
$css- Css content of the file.
Return:
true – it will exclude the entered css file from minification.
false – it will not exclude the entered css file from minification.
Source:



function w3speedup_internal_css_minify($path,$css){
   if(strpos($path,'//cssPath//') !== false){
      return false;
   }
   return true;
}

DYNAMICALLY FORCE DEFER OF STYLESHEET FILES

Function: W3_customize_force_lazyload_css
Description: If you wish to Force Lazyload CSS files dynamically for a specific page or pages, you can do so with the W3Speedster, it allows you to dynamically force lazyload stylesheet files (for instance font file like awesome, dashicons and css files).
Parameter:
$css_arr – Array containing text to force lazyload which you have mentioned in the plugin configuration.
Return:
$css_arr – Array containing text to force lazyload.
Source:



function w3_customize_force_lazyload_css($css_arr){
   //custom code here
   return $css_arr;
}

CUSTOMIZE CRITICAL CSS FILENAMES

Function: W3speedup_customize_critical_css_filename
Description: If you wish to make any changes in Critical CSS filename, W3Speedster allows you to change in critical CSS file names. W3Speedster creates file names for critical CSS files but if you wish to change the name according to your preference this function will help.
Parameter:
$critical_css_filename – File name of the critical css.
Return:
$critical_css_filename – New name of the critical css file.
Source:



    function W3speedup_customize_critical_css_filename($critical_css_filename){
        $critical_css_filename = str_replace(' ',' ',$critical_css_filename);
         return $critical_css_filename;
      }

MAKE CHANGES IN GENERATED CRITICAL CSS

Function: W3speedup_customize_critical_css
Description: If you wish to make any changes in Critical CSS, W3Speedster allows you to make changes in generated Critical CSS. For instance if you want to replace/ remove any string/URL from critical CSS (like @font-face { font-family:”Courgette”; to @font-face { ).
Parameter:
$critical_css- Critical Css of the page.
Return:
$critical_css – Reflect the changes made in critical css.
Source:



    function w3speedup_customize_critical_css($critical_css){
        $critical_css = str_replace('@font-face { font-family:"Courgette";', ' ',$critical_css);
        return $critical_css;
    }

Work with us at No Risk.

We guarantee to speed ster  WordPress in the given timeframe. You will get a 100% refund if you are not satisfied with our work So, what are you waiting for?

+1-775-234-8474

Request FREE Consultation

Need Proof of Our Work?

Just Click on the button and it will take you to the client’s review page.

Our Client Review