Plugin / SG Optimizer
SiteGroundDescription
Description
This plugin is designed to link WordPress with the SiteGround Performance services. It WILL NOT WORK on another hosting provider.
The SG Optimizer plugin has few different parts handling speciffic performance optimizations:
Configuration
For detailed information on our plugin and how it works, please check out our SG Optimizer Tutorial.
SuperCacher Settings
In this tab, you can configure your Dynamic Caching and Memcached. Make sure you’ve enabled them from your cPanel before using the plugin. You can enable/disable the automatic cache purge, exclude URLs from the cache and test your pages if they are properly cached.
Environment Optimization
Here, you can force HTTPS for your site, switch between different PHP Versions (compatibility check available), and enable or disable Gzip Compression and Borwser Caching rules for your site.
Frontend Optimization
In this tab, you can enable or disable Minification of your HTML, JS and CSS resources, remove the Emoji support and remove the query strings from your static resources.
Image Optimization
Here, you can enable or disable optimization for your newly uploaded images, bulk optimize your old ones and enable lazy loading for your site images.
Plugin Compatibility
If your plugin does not trigger standard WordPress hooks or you need us to purge the cache, you can use this public function in your code:
if (function_exists('sg_cachepress_purge_cache')) {
sg_cachepress_purge_cache();
}
Preferrably, you can pass an URL to the function to clear the cache just for it instead of purging the entire cache. For example:
if (function_exists('sg_cachepress_purge_cache')) {
sg_cachepress_purge_cache('https://yoursite.com/pluginpage');
}
You can exclude styles from being combined and minified using the filters we’ve designed for that purpose. Here’s an example of the code, you can add to your functions.php file:
add_filter( 'sgo_css_combine_exclude', 'css_combine_exclude' );
function css_combine_exclude( $exclude_list ) {
// Add the style handle to exclude list.
$exclude_list[] = 'style-handle';
$exclude_list[] = 'style-handle-2';
return $exclude_list;
}
add_filter( 'sgo_css_minify_exclude', 'css_minify_exclude' );
function css_minify_exclude( $exclude_list ) {
// Add the style handle to exclude list.
$exclude_list[] = 'style-handle';
$exclude_list[] = 'style-handle-2';
return $exclude_list;
}
You can exclude script from being minified using the filter we’ve designed for that purpose. Here’s an example of the code, you can add to your functions.php file:
add_filter( 'sgo_js_minify_exclude', 'js_minify_exclude' );
function js_minify_exclude( $exclude_list ) {
$exclude_list[] = 'script-handle';
$exclude_list[] = 'script-handle-2';
return $exclude_list;
}
You can exclude script from being loaded asynchronous using the filter we’ve designed for that purpose. Here’s an example of the code, you can add to your functions.php file:
add_filter( 'sgo_js_async_exclude', 'js_async_exclude' );
function js_async_exclude( $exclude_list ) {
$exclude_list[] = 'script-handle';
$exclude_list[] = 'script-handle-2';
return $exclude_list;
}
You can exclude url or url that contain specific query param using the following filters:
add_filter( 'sgo_html_minify_exclude_params', 'html_minify_exclude_params' );
function html_minify_exclude_params( $exclude_params ) {
// Add the query params that you want to exclude.
$exclude_params[] = 'test';
return $exclude_params;
}
add_filter( 'sgo_html_minify_exclude_urls', 'html_minify_exclude' );
function html_minify_exclude( $exclude_urls ) {
// Add the url that you want to exclude.
$exclude_urls[] = 'http://mydomain.com/page-slug';
return $exclude_urls;
}
You can exclude images from Lazy Load using the following filter:
add_filter( 'sgo_lazy_load_exclude_classes', 'exclude_images_with_specific_class' );
function exclude_images_with_specific_class( $classes ) {
// Add the class name that you want to exclude from lazy load.
$classes[] = 'test-class';
return $classes;
}
WP-CLI Support
In version 5.0 we’ve added full WP-CLI support for all plugin options and functionalities.
- wp sg purge (url) – purges the entire cache or if URL is passed
- wp sg memcached enable|disable – enables or disables Memcached
- wp sg forcehttps enable|disable – enables or disables HTTPS for your site
- wp sg phpver check (–version=) – checks your site for compatibility with PHP 7.1 or the version you specify
- wp sg optimize – enables or disables different optimization options for your site:
- wp sg optimize html enable|disable – enables or disables HTML minification
- wp sg optimize js enable|disable – enables or disables JS minification
- wp sg optimize css enable|disable – enables or disables CSS minification
- wp sg optimize querystring enable|disable – enables or disables query strings removal
- wp sg optimize emojis enable|disable – enables or disables stripping of the Emoji scripts
- wp sg optimize images enable|disable – enables or disables New image optimization
- wp sg optimize lazyload enable|disable – enables or disables Lazy loading of images
- wp sg optimize gzip enable|disable – enables or disables Gzip compression for your site
- wp sg optimize browsercache enable|disable – enables or disables Browser caching rules
- wp sg optimize dynamic-cache enable|disable – enables or disables Dynamic caching rules
- wp sg optimize google-fonts enable|disable – enables or disables Google Fonts Combination
- wp sg status dynamic-cache|autoflush-cache|mobile-cache|html|js|js-async|css|combine-css|querystring|emojis|images|lazyload_images|lazyload_gravatars|lazyload_thumbnails|lazyload_responsive|lazyload_textwidgets|gzip|browser-caching|memcache|ssl|ssl-fix|autoflush|dynamic-cache|google-fonts – returns optimization current status (enabled|disabled)
Requirements
In order to work correctly, this plugin requires that your server meets the following criteria:
- SiteGround account
- WordPress 4.7
- PHP 5.5
- If you’re not hosted with SiteGround this plugin WILL NOT WORK because it relies on a specific server configuration
Our plugin uses a cookie in order to function properly. It does not store personal data and is used solely for the needs of our caching system.
Ratings
Rating breakdown
Details Information
Version
First Released
Total Downloads
Wordpress Version
Tested up to:
Require PHP Version:
Tags
Contributors
Languages
DIRECTORY DISCLAIMER
The information provided in this THEME/PLUGIN DIRECTORY is made available for information purposes only, and intended to serve as a resource to enable visitors to select a relevant theme or plugin. wpSocket gives no warranty of any kind, express or implied with regard to the information, including without limitation any warranty that the particular theme or plugin that you select is qualified on your situation.
The information in the individual theme or plugin displayed in the Directory is provided by the owners and contributors themselves. wpSocket gives no warranty as to the accuracy of the information and will not be liable to you for any loss or damage suffered by you as a consequence of your reliance on the information.
Links to respective sites are offered to assist in accessing additional information. The links may be outdated or broken. Connect to outside sites at your own risk. The Theme/Plugin Directory does not endorse the content or accuracy of any listing or external website.
While information is made available, no guarantee is given that the details provided are correct, complete or up-to-date.
wpSocket is not related to the theme or plugin, and also not responsible and expressly disclaims all liability for, damages of any kind, arising out of the use, reference to, or reliance on, any information or business listed throughout our site.