Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Jono Alderson'-Turbocharging your Wordpress Web...

Distilled
December 04, 2014

Jono Alderson'-Turbocharging your Wordpress Website

Distilled

December 04, 2014
Tweet

More Decks by Distilled

Other Decks in Technology

Transcript

  1. @jonoalderson Turbo-charging your WordPress website ! Jono Alderson Head of

    Insight @ Linkdex! @jonoalderson ! Technical SEO + analytics geek Closet web developer & Wordpress fanatic
  2. @jonoalderson Turbo-charging your WordPress website When we started talking about

    content marketing, we stopped talking about technical optimisation. ! “on page” is not the same as “technical”
  3. @jonoalderson Turbo-charging your WordPress website We’ve all seen the impact

    of technical bugs/faults/etc. ! Broken pages, missing redirects, indexation faults, etc...
  4. @jonoalderson Turbo-charging your WordPress website Ditch the crappy metaphor! Yes,

    it works as a loose analogy, but it gives people permission to think about it in an abstract sense.
  5. @jonoalderson Turbo-charging your WordPress website Visualising Performance Speed • Google

    PageSpeed Insights, ySlow • Google Analytics • Pingdom, WebPageTest*
  6. @jonoalderson Turbo-charging your WordPress website There is no ‘site speed’

    number which Google uses. An aside… 
 Developers HATE this.
  7. @jonoalderson Turbo-charging your WordPress website Visualising Performance User Experience •

    How’s it “feel”? Consider the psychology of the loading experience • User experience index, general quality, give-a-damn • Track it, benchmark it. Surveying and feedback tools
  8. @jonoalderson Turbo-charging your WordPress website Visualising Performance Technical optimisation &

    security • Bandwidth/overhead optimisation • Adoption of technologies (open graph, responsive images, caching, etc) • Minimising risks of hacking, DDOS
  9. @jonoalderson Turbo-charging your WordPress website Don’t go anywhere without installing:


    ! W3 Total Cache* Redirection BWP Sitemaps Broken Link Checker iThemes Security* Akismet* Query Monitor
  10. @jonoalderson Turbo-charging your WordPress website You may also like... !

    BWP Minify Yet Another Related Posts Plugin* YARPP Experiments Relevanssi* WP-PageNavi Kraken.io* Google Tag Manager for Wordpress User Role Editor Custom Post Type Permalinks
  11. @jonoalderson Turbo-charging your WordPress website Third Party Services Cloudflare (or

    MaxCDN) NewRelic An SSL certificate (ssl2buy.com) ! ...some kind of backup processes... ...and some proper hosting...
  12. @jonoalderson Turbo-charging your WordPress website “My wordpress seo tends to

    be limited to ‘install the yoast plugin’ and do the usual site stuff...” Jim Seward, @iamoldskool
  13. @jonoalderson Turbo-charging your WordPress website DIY HOSTING Shared, Dedicated, or

    VPS *(vs Clusters & hardcore setups, AWS elastic cloud computing)
  14. @jonoalderson Turbo-charging your WordPress website wp-config.php
 Security settings Auto update

    settings Limit revision & trash storage Cookie stuff Set memory allowance Force SSL Set language ! http://codex.wordpress.org/Editing_wp-config.php
  15. @jonoalderson Turbo-charging your WordPress website Expert Tip... You can use

    pre_get_posts to intercept and 
 change how requests are processed
  16. @jonoalderson Turbo-charging your WordPress website ! Custom Error Files !

    <?php
 // Set headers before outputting the page HTML
 header('HTTP/1.1 503 Service Temporarily Unavailable');
 header('Status: 503 Service Temporarily Unavailable');
 header('Retry-After: 3600'); // 1 hour = 3600 seconds
 ?> <html>
 ... wp-content/maintenance.php wp-content/db-error.php
  17. @jonoalderson Turbo-charging your WordPress website Expert Tip... Clean up WP

    and plugin overheads // Clean up wp_head() function cleanhead() { remove_action('wp_head', 'rsd_link'); remove_action('wp_head', 'wlwmanifest_link'); remove_action('wp_head', 'wp_generator'); remove_action('wp_head', 'feed_links_extra', 3 ); remove_action('wp_head', 'feed_links', 2 ); remove_action('wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0 ); remove_action('wp_head', 'rel_canonical'); remove_action('wp_head', 'wp_shortlink_wp_head', 10, 0 ); } add_action('init', 'cleanhead');
  18. @jonoalderson Turbo-charging your WordPress website Expert Tip... Clean up WP

    and plugin overheads // Ged rid of superfluous CSS function deregister_styles() { if (!is_admin()) { wp_deregister_style('avatars'); wp_deregister_style('imgareaselect') wp_deregister_style('avatar-manager.css'); wp_deregister_style('yarppRelatedCss'); } } add_action( 'wp_print_styles', 'deregister_styles');
  19. @jonoalderson Turbo-charging your WordPress website Expert Tip... Kill unnecessary templates

    // Kill misc pages add_action('template_redirect', 'jono_nerf_pages'); function jono_nerf_pages() { global $wp_query, $post; if (is_day() || is_month() || is_year()) { header("HTTP/1.0 404 Not Found"); $wp_query->set_404(); } if (is_attachment()) { header("HTTP/1.1 301 Moved Permanently"); header("Location: ".get_permalink($post->post_parent)); exit; } if (is_feed()) { header("HTTP/1.0 404 Not Found"); $wp_query->set_404(); wp_query->is_feed = false; } if ((is_archive()) && (!have_posts())) { header("HTTP/1.0 404 Not Found"); $wp_query->set_404(); } }
  20. @jonoalderson Turbo-charging your WordPress website Your Theme Performance PHP &

    database! Theme files and functions! Plugins & widgets
  21. @jonoalderson Turbo-charging your WordPress website I’m not going to tell

    you how to configure this. Your site is unique.
  22. @jonoalderson Turbo-charging your WordPress website Expert Tip... You can move

    redirects from out of WordPress
 and into .htaccess from within the plugin admin
  23. @jonoalderson Turbo-charging your WordPress website apple-touch-icon.png (and variants) favicon.ico (and

    variants) browserconfig.xml Invalid or un-used feeds invalid page/date ranges broken internal links (and missing http links) alternate sitemap and meta data urls pages & images with weird, breaking parameters security probes legacy urls Some things to watch out for...
  24. @jonoalderson Turbo-charging your WordPress website Cloudflare + Subdomains + W3

    Total Cache = MAGIC Configure in W3TC as a “Generic Mirror”
  25. @jonoalderson Turbo-charging your WordPress website Expert Tip... Redirect requests which

    resolve to your CDN subdomains (or other hostnames) // Redirect requests from non-primary domains function domain_redirect() { $hostname = $_SERVER['HTTP_HOST']; $mainDomains = array('www.daysoftheyear.com','app.daysoftheyear.com'); if (!in_array($hostname,$mainDomains)) { $uri = $_SERVER['REQUEST_URI']; wp_redirect( 'https://www.daysoftheyear.com'.$uri, 301 ); exit; } } add_action('init', 'domain_redirect');
  26. @jonoalderson Turbo-charging your WordPress website Expert Tip... Use established CDNs

    to server common/large resources (like jQuery) // Use Google CDN for jQuery
 function modify_jquery() {
 if (!is_admin()) { wp_deregister_script('jquery');
 wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js', false, '1.11.1');
 wp_enqueue_script('jquery');
 }
 }
 add_action('init', 'modify_jquery');
  27. @jonoalderson Turbo-charging your WordPress website HTTPS / SSL Change to

    protocol-relative URLs (//example.com/file/) 
 References in CSS/JS & third party stuff ! Purchase & install key* (Cloudflare is MAGIC) Buy the right type (single, multi, wildcard) ! Tweak CDN config ! W3 Total Cache config
  28. @jonoalderson Turbo-charging your WordPress website Expert Tip... Database find &

    replace update TABLE_NAME set FIELD_NAME = replace(FIELD_NAME, œš‘“›⁸find this string’”⁹, œš‘“›⁸replace found string with this string’”⁹); ...or cheat... “Search and Replace” plugin
  29. @jonoalderson Turbo-charging your WordPress website HTTPS / SSL Force SSL

    in wp-config.php (esp. if using Cloudflare) // Force SSL define('FORCE_SSL_ADMIN', true); if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') $_SERVER['HTTPS']='on';
  30. @jonoalderson Turbo-charging your WordPress website HTTPS / SSL Force SSL

    in .htaccess! ! http://www.webhostinghub.com/help/learn/website/ssl/force-website-to-use-ssl
  31. @jonoalderson Turbo-charging your WordPress website Media Optimisation ! Pay attention

    to every detail.! Kraken, but get it right first.! Photoshop isn’t good enough; use dedicated kit
  32. @jonoalderson Turbo-charging your WordPress website Expert Tip... Change default media

    links // Change image default link function misc_change_image_default_link() {
 $image_set = get_option( 'image_default_link_type' );
 if ($image_set !== 'none') {
 update_option('image_default_link_type', 'none');
 }
 }
 add_action('admin_init', 'misc_change_image_default_link', 10);
  33. @jonoalderson Turbo-charging your WordPress website Expert Tip... Lowercase filenames //

    Lowercase filenames add_filter('sanitize_file_name', 'mfl_make_filename_lowercase', 10); function mfl_make_filename_lowercase($filename) { $info = pathinfo($filename); $ext = empty($info['extension']) ? '' : '.' . $info['extension']; $name = basename($filename, $ext); return strtolower($name) . $ext; }
  34. @jonoalderson Turbo-charging your WordPress website Expert Tip... Responsive Images (without

    the overhead…) <picture> <!--[if IE 9]><video style="display: none;"><![endif]--> <source srcset="small-image.jpg" media="(max-width: 480px)"> <source srcset="medium-image.jpg" media="(max-width: 720px)"> <source srcset="large-image.jpg" media="(max-width: 1024px)"> <source srcset="xlarge-image.jpg" media="(max-width: 1280px)"> <!--[if IE 9]></video><![endif]--> <img srcset="xlarge-image.jpg" alt="" /> </picture>
  35. @jonoalderson Turbo-charging your WordPress website Expert Tip... Responsive Images (without

    the overhead…) // Thumbnail sizes add_image_size( 'cols-1-small', 480, 314, array( 'left', 'top' ) ); add_image_size( 'cols-1-med', 720, 470, array( 'left', 'top' ) ); add_image_size( 'cols-1-large', 1024, 669, array( 'left', 'top' ) ); add_image_size( 'cols-1-xlarge', 1024, 669, array( 'left', 'top' ) ); ! add_image_size( 'cols-2-small', 240, 157, array( 'left', 'top' ) ); add_image_size( 'cols-2-med', 360, 236, array( 'left', 'top' ) ); add_image_size( 'cols-2-large', 512, 335, array( 'left', 'top' ) ); add_image_size( 'cols-2-xlarge', 512, 335, array( 'left', 'top' ) );
  36. @jonoalderson Turbo-charging your WordPress website Stuff I haven’t talked about...

    Parent/child theme relationships PHP(!) Transient caching Device-type optimisation Awkward SSL stuff (chain certificates) CSS/JS optimisation WP Cron, Ajax & the Heartbeat API Browser reflow and repaint ! (That may own websites are a bit slow, and far from perfect!) ! Take it one step at a time.
  37. @jonoalderson Turbo-charging your WordPress website Learn (some of) this stuff!

    And not just because you want to be “full stack”.
  38. @jonoalderson Turbo-charging your WordPress website And if you’re not at

    least thinking about this stuff…?
 
 Maybe all you’re doing is “marketing”.
  39. @jonoalderson Turbo-charging your WordPress website ! Jono Alderson Head of

    Insight @ Linkdex! @jonoalderson ! (and also www.daysoftheyear.com)