1 of 25

WordPress Faster!

#bainternetsites

en.bainternet.info

admin@bainternet.info

2 of 25

Who Am I???

  • A father and husband.
  • Ohad Raz (A.K.A.WP.W as Bainternet).
  • WordPress Consultant, Developer and sometimes designer.
  • Developer Plugin, more then 20 published plugins on WordPress.org with over 370,000 downloads.
  • WordPress Core contributor.
  • Moderator and Editor @ WordPress Development.
  • One of the guys beahind GenerateWP.

* A.K.A.WP.W - Also Known As In WordPress World

3 of 25

WordPress Faster!

Wait, What?

4 of 25

Why should You care?

  • First Impression.
  • Returning visits.
  • Better Conversions of subscribers, customers and sales.
  • Google has included site speed in it’s ranking algorithm.

5 of 25

So How to make your WordPress Faster?

WordPress Optimaized Host.

Theme.

Plugins.

Cache.

CDN.

Optimize and lazy load Images.

Optimize Database.

Some Coding Best Practice.

6 of 25

So How to make your WordPress Faster?

WordPress Optimaized Host - Propbably the most common issues with Slow WordPress sites is poor Hosting. Oversold shared servers can cause long delays. These “All purpose” shared servers are not optimal for WordPress based sites.

If (you can and know how){

Use a deticated server or at least a VPS for any medium to high�traffic sites.

}ElseIf(you can){

Use a WordPress Optimized or even managed hosting.

}Else{

Well, you can still work with shared hosting and get some good� results, If you follow the rest of slides.

}

7 of 25

So How to make your WordPress Faster?

WordPress Optimaized Host.

Theme.

Plugins.

Cache.

CDN.

Optimize and lazy load Images.

Optimize Database.

Some Coding Best Practice.

8 of 25

So How to make your WordPress Faster?

Themes - Badly coded themes can and will slow you site down.

Make sure your theme is not overloaded and hold only or mostly just the features you need from it.

Bottom line: make sure your theme is NOT the cause for your slow site.

9 of 25

So How to make your WordPress Faster?

WordPress Optimaized Host.

Theme.

Plugins.

Cache.

CDN.

Optimize and lazy load Images.

Optimize Database.

Some Coding Best Practice.

10 of 25

So How to make your WordPress Faster?

Plugins - Just like themes plugins can slow your WordPress Site.

First of a very common “slow WordPress issue” is caused by the use of ”Too Many” plugins.

Another major issue is badly developed plugins which you can hunt down using plugin performance profiler.

Bottom line: Use only what you need, make sure its in the latest version (for security as well) and remove the rest.

11 of 25

So How to make your WordPress Faster?

WordPress Optimaized Host.

Theme.

Plugins.

Cache.

CDN.

Optimize and lazy load Images.

Optimize Database.

Some Coding Best Practice.

12 of 25

So How to make your WordPress Faster?

Cache - Not using a cache plugin is the number one reason for slow WordPress Sites, But fear not, Its the easest one to solve: �

Install a Cache plugin!

Beacuse:

  • A cache plugin will save you money!
  • A cache plugin will make your site faster.
  • A cache plugin will make the World better.

Bottom line:

Install a Cache plugin!

13 of 25

So How to make your WordPress Faster?

WordPress Optimaized Host.

Theme.

Plugins.

Cache.

CDN.

Optimize and lazy load Images.

Optimize Database.

Some Coding Best Practice.

14 of 25

So How to make your WordPress Faster?

CDN- Basically a CDN (Content Delevery Network) takes all of your sites static files (CSS, JavaScript, Images etc..) and serves them to your users from an optimized server located closest to them as possible.�

Beacuse:

  • A CDN will save you money!
  • A CDN will make your site faster.
  • A CDN will make the World better.

Bottom line: Use a CDN!

15 of 25

So How to make your WordPress Faster?

WordPress Optimaized Host.

Theme.

Plugins.

Cache.

CDN.

Optimize and lazy load Images.

Optimize Database.

Some Coding Best Practice.

16 of 25

So How to make your WordPress Faster?

Optimize Images - There are a few tools (and plugins) for optimizing Images by reducing the size of the image file, while not damaging the Quality.

Lazy Loading Images - means you only load the images that are visible in the browsers view and when the users scroll down, then the rest of the page images begin to load, just before they come into view.

Beacuse:

  • Optimizing and Lazy loading will save you money!
  • Optimizing and Lazy loading will make your site faster.
  • Optimizing and Lazy loading will make the World better.

Bottom line: Do IT!

17 of 25

So How to make your WordPress Faster?

WordPress Optimaized Host.

Theme.

Plugins.

Cache.

CDN.

Optimize and lazy load Images.

Optimize Database.

Some Coding Best Practice.

18 of 25

So how to make your WordPress Faster?

Optimize Database - One of the best features of WordPress as a CMS is the fact that it often autosaves everything, But this has a major drawback which is the fact that the database gets filled with post revisions, trackbacks, pingbacks, spam comments, trashed items and other stuff you really don’t need.

Bottom line: Use a plugin that will take care of that for you.

19 of 25

So How to make your WordPress Faster?

WordPress Optimaized Host.

Theme.

Plugins.

Cache.

CDN.

Optimize and lazy load Images.

Optimize Database.

Some Coding Best Practice.

20 of 25

So How to make your WordPress Faster?

Some Coding Best Practice - Few tips and tricks I’ve picked up.

Efficient Database Queries :

  • Use WP_Query object and not get_posts() or $wpdb.

  • Get to know the ‘fields’ parameter e.x: 'fields' => 'ids'

  • Avoid 'posts_per_page' => -1.

  • Set 'no_found_rows' => true if you are not using pagination.

  • Set 'update_post_meta_cache' => false when you dont need post meta.

  • Set 'update_post_term_cache' => false when you dont need Taxonomy terms.

21 of 25

So How to make your WordPress Faster?

Some Coding Best Practice.�

Efficient AJAX Requests: WordPress Provides an API to setup an AJAX endpoint, on the ‘admin-ajax.php’ url:

add_action(‘wp_ajax_my_action_name’,’my_callback_function’);

�This is nice and easy to use but it also means no caching will be done on queries within my_callback_function() .

22 of 25

So How to make your WordPress Faster?

Some Coding Best Practice.�

To get around this issue you can use the Rewrite Rules API to hook your front-facing endpoint:

// Register a rewrite endpoint for the API.

add_action( 'init', 'add_api_endpoints_suffix' );

function add_api_endpoints_suffix() {

add_rewrite_tag( '%api_action_name%', '([0-9]+)' );

add_rewrite_rule( 'api/actions/([0-9]+)/?', 'index.php?api_action_name=$matches[1]', 'top' );

}

//Handle API endpoint.

add_action( 'template_redirect', 'handle_api_endpoint' );

function handle_api_endpoint() {

global $wp_query;

$action = $wp_query->get( 'api_action_name' );

if ( ! empty( $action ) ) {

$response = array();

// Do stuff with $action

wp_send_json( $response );

}

}

23 of 25

So How to make your WordPress Faster?

WordPress Optimaized Host.

Theme.

Plugins.

Cache.

CDN.

Optimize and lazy load Images.

Optimize Database.

Some Coding Best Practice.

24 of 25

So How to make your WordPress Faster?

25 of 25

So How to make your WordPress Faster?

Questions?