SG Optimizer – WordPress plugin Free download
SG Optimizer
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
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.
Screenshots






Installation
Automatic Installation
Go to Plugins -> Add New
Search for “SG CachePress”
Click on the Install button under the SG CachePress plugin
Once the plugin is installed, click on the Activate plugin link
Manual Installation
Login to the WordPress admin panel and go to Plugins -> Add New
Select the ‘Upload’ menu
Click the ‘Choose File’ button and point your browser to the SGCachePress.zip file you’ve downloaded
Click the ‘Install Now’ button
Go to Plugins -> Installed Plugins and click the ‘Activate’ link under the WordPress SG CachePress listing