Making WordPress websites faster

Post on 15-Apr-2017

479 views 2 download

Transcript of Making WordPress websites faster

Aki Björklund

Making WordPress websites faster

© 1998 PhotoSpin

Average page is 2225 kBin size and growing

Source: http://www.soasta.com/blog/page-bloat-average-web-page-2-mb/

In Finland: WordPress sites average 2,5 MB

Page size matters

Page sizedoes not matter

(that much)

Page size≠

page performance

Page performance ≠

server-side performance

PRACTICAL TIPS

Optimize images

Optimize images for users automatically

Never use the original sizes of uploaded images

Prevent users usingthe full size image

There is a filter for that

function h1_remove_full_image_size( $sizes ) { unset( $sizes['full'] ); return $sizes; }

add_filter( 'image_size_names_choose', 'h1_remove_full_image_size' );

Built-in responsive images in WordPress

Don’t load imagesa.k.a. lazy loading

Make browserscache resources

Minimize,combine, compress

Minimize,combine, compress

Minimize,combine, compress

Minimize,combine, compress

Advanced stuff

Move scripts to bottom

…with WP Simple Asset Optimizer

Moving scriptsadd_filter( 'wpsao_move', function () { return array( 'jquery_json', 'gform_placeholder', 'gform_gravityforms', 'optin-monster-api-script', 'wp-mediaelement', 'visualizer-google-jsapi', 'visualizer-render' ); } );

Inline CSS and JavaScript

Inliningadd_filter( 'wpsao_inline', function () { return array( 'modernizr', 'h1-stylesheet' => array( 'replace' => '../../', 'with' => get_template_directory_uri() . '/assets/' ) ); } );

HTTP/2

SERVER SIDE OPTIMIZATION

Caching

Page caching

Full page caching does not work if users are

logged in

Object caching

PHP7

Topics skipped: CDNs, responsive and retina images, continuous performance

measurement, inlining images, CSS sprites, prioritizing visible content, avoiding

redirects, DNS, asynchronous JavaScript…

Thanks!

@akibjorklund