Here are a few helpful tips for your WordPress site:

1) Add Expire Headers

Add the following code to your .htaccess file:

<IfModule mod_expires.c>
ExpiresActive on
ExpiresDefault “access plus 1 month”
ExpiresByType image/gif “access plus 1 month”
ExpiresByType image/png “access plus 1 month”
ExpiresByType image/jpg “access plus 1 month”
ExpiresByType image/jpeg “access plus 1 month”
ExpiresByType text/html “access plus 3 days”
ExpiresByType text/xml “access plus 1 seconds”
ExpiresByType text/plain “access plus 1 seconds”
ExpiresByType application/xml “access plus 1 seconds”
ExpiresByType application/rss+xml “access plus 1 seconds”
ExpiresByType application/json “access plus 1 seconds”
ExpiresByType text/css “access plus 1 week”
ExpiresByType text/javascript “access plus 1 week”
ExpiresByType application/javascript “access plus 1 week”
ExpiresByType application/x-javascript “access plus 1 week”
ExpiresByType image/x-ico “access plus 1 year”
ExpiresByType image/x-icon “access plus 1 year”
ExpiresByType application/pdf “access plus 1 month”
<IfModule mod_headers.c>
Header unset ETag
Header unset Pragma
Header unset Last-Modified
Header append Cache-Control “public, no-transform, must-revalidate”
Header set Last-modified “Tue, 1 Aug 2016 10:10:10 GMT”
</IfModule>
</IfModule>

2) Enable GZip compression

Add the following code to your .htaccess file:

<IfModule mod_deflate.c>
# Compress HTML, CSS, JavaScript, Text, XML and fonts
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE application/x-font
AddOutputFilterByType DEFLATE application/x-font-opentype
AddOutputFilterByType DEFLATE application/x-font-otf
AddOutputFilterByType DEFLATE application/x-font-truetype
AddOutputFilterByType DEFLATE application/x-font-ttf
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE font/opentype
AddOutputFilterByType DEFLATE font/otf
AddOutputFilterByType DEFLATE font/ttf
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE image/x-icon
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/xml

# Remove browser bugs (only needed for really old browsers)
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
Header append Vary User-Agent
</IfModule>

3) Defer Parsing of Java Scripts

Some themes have built in JS handlers so they can be used to defer JS parsing, you can simply do it by adding the following given code in active theme Function.php file before closing of PHP tag (?>)

Note – I would HIGHLY recommend making a backup of the Function.php file before implementing…just to be safe.

function defer_parsing_of_js ( $url ) {
if ( FALSE === strpos( $url, ‘.js’ ) ) return $url;
if ( strpos( $url, ‘jquery.js’ ) ) return $url;
return “$url’ defer “;
}
add_filter( ‘clean_url’, ‘defer_parsing_of_js’, 11, 1 );

4) If Admin-Ajax.php is causing some slowness on load times, try this:

The WordPress Heartbeat API uses /wp-admin/admin-ajax.php to run AJAX calls from the web-browser. While this is great and all it can also cause high CPU usage and crazy amounts of PHP calls. For example if you leave your dashboard open it will keep sending POST requests to this file on a regular interval.

There is a great free plugin now in the WordPress repository called heartbeat control which can help you fix this problem. Follow the steps below to configure.

Step 1

Install Heartbeat control.

Step 2

Go to Settings and click into “Heartbeat Control.”

Step 3

Under “Control heartbeat locations” you have a couple options:

Use default
Disable everywhere
Disable on dashboard page
Allow only on post edit pages (I use the “Allow only on post edit pages” myself)

You can disable it altogether but remember this controls auto-saving and if you are working on a multi-author blog with multiple sessions this is something to take into consideration. Also the heartbeat API is used by a variety of plugins and disabling it could cause them to stop functioning.

Step 4

Then you can setting the heartbeat polling frequency. I set mine to 60 seconds.

That should hopefully take care of some of your problems. If you are still experiencing delays than I would take a look at the next issue below.


Check back soon…more helpful tips coming.