Removing text using String.prototype
By this method it does not change the original string but returns a new string.
This method extracts parts of a string and returns the extracted parts as a new string. It takes two parameter which specify the parts of the string to be extracted.
it specifies the position to begin the extraction. This parameter is mandatory. The first character is at position 0.
it specifies the position where the extraction should end. This parameter is optional and if not provided, slice() selects all characters from the start position to the end of the string.
For this we have to use regular expression and match that to the given string and get the output as number.
Remove Query Strings from Static Resources to Increase your Website Speed
Page load time is an essential aspect for a website or blog. It helps to deliver an effective user experience to visitors. It also helps to get higher ranking in google search as a result will increase in overall traffic on your website.
What are the Query Strings in WordPress?
Query strings are the URLs which contains “?” or “&”. It is similar to CSS and JS files to website, which is usually have the file version on the end of their URLs. Therefore query strings resources would be resource URLs with a “?” or “&”.
The Query Strings are used to version a file which differentiates the resource files from one to another. It useful for developers to avoid caching problems.
Should you Remove Query Strings from Static Resources?
How to Remove Query Strings from Static Resources?
- Open the functions.php file of your WordPress theme
- Copy and paste the given-below code at the end of functions.php file.
Remove Query Strings from Static Resources – WordPress plugin
1. Remove Query Strings from Static Resources – WP plugin
Query Strings can be removed by using a WordPress plugin called remove query strings from static resources. By installing and activating this plugin, there will be no setting panel.
2. W3 Total Cache – WP plugin
Remove Query Strings from Static Resources with W3 Total Cache plugin. Users can use W3 Total Cache plugin settings optimization guide to increase web page loading time. This plugin will increase the website loading speed.
W3 total cache plugin offers an option to remove query strings resources. It is only needed to UNCHECK an option and it will remove query strings from 90% of the URLs. Go to browser cache tool tab and find “prevent caching of objects after settings change” option. UNCHECK it from ‘general settings’ and click on ‘save settings’. Now ‘empty all cache’. The speed of the page will increase.
3. WP Remove Query Strings from Static Resources
All the Query Strings will be removed automatically from static resources by installing the plugin and activate it.
Why minifying is so important?
Minification reduces reduces size of web page which result to increase in PageSpeed.
What is minifying?
Minifying process removes any unwanted code from website like
- Unused spaces that is written CSS
- Unnecessary line-breaks in HTML
It will update theme on regular basis . Any theme update will not hamper file magnification process.
4. W3 Total Cache
Many of the WordPress users use this plugin to increase web PageSpeed.
- Install W3 total cache plugin and activate it.
- Go to the general settings tab and minify settings
- Check minify enable setting
- Click on save all settings button, clear all cache
- Install this plugin and activate it
- Go to plugin’s setting panel
- Click on save changes and empty cache button.
6. WP Fastest Cache
7. Fast Velocity Minify