simple ways to optimise wordpress

No you don’t have to use w3tc or wp super cache. wordpress becomes slow when db queries grow. a quick way is to find the expensive queries and speed them up by caching them.

for example,

$sql = "select post_id from {$wpdb->prefix}postmeta where meta_key='_blar' and meta_value='$value'";

$id = wp_cache_get( 'id_'.$value );
if ( false === $id ) {
  $id = $wpdb->get_var($sql);
  wp_cache_set( 'id_'.$value, $id );

transient is also a fantastic way of caching –

Like it.? Share it:

Comments are closed.