This very simple plugin makes WordPress website more performant with following techniques:
- Lazyload for images and iframes
- Adding defer attribute to script tag
- Install the plugin from the official plugin directory.
- Activate the plugin.
- Profit
Feel free to improve the plugin and open pull request.
You need to have node.js and yarn installed.
- Clone repository
git clone [email protected]:mejta/wp-accelerate.git
. - Install dependencies with
yarn
- Start development process with
yarn start --output /some/wp/installation/wp-content/plugins/wp-accelerate
command. It will start a build in watch mode and after every change copies files to folder of your choice - e.g. plugin folder in existing installation. Output parameter must be an absolute path to the folder with plugin.
- Activate the plugin
- To disable lazyload use filter
wp_accelerate_lazyload
add_filter('wp_accelerate_lazyload', function($do_lazyload) {
if (is_cart() || is_checkout() || is_account_page() || is_wc_endpoint_url() || is_ajax()) return false;
return $do_lazyload;
});
This plugin was created after training by Martin Michálek and his course Optimization of Load speed.