How to optimize ‘select found_rows()’ query? Several ‘high load average’ alerts daily

This should not break pagination: add_filter(‘pre_get_posts’, ‘optimized_get_posts’, 100); function optimized_get_posts() { global $wp_query, $wpdb; $wp_query->query_vars[‘no_found_rows’] = 1; $wp_query->found_posts = $wpdb->get_var( “SELECT COUNT(*) FROM wp_posts WHERE 1=1 AND wp_posts.post_type=”post” AND (wp_posts.post_status=”publish” OR wp_posts.post_status=”private”)” ); $wp_query->found_posts = apply_filters_ref_array( ‘found_posts’, array( $wp_query->found_posts, &$wp_query ) ); if($wp_query->query_vars[‘posts_per_page’] <= 0) { $wp_query->max_num_pages = 0; } else { $wp_query->max_num_pages = ceil($wp_query->found_posts … Read more

How to let users clear their posts cache with WP Super Cache?

Last time I used this plugin, you had to flush the entire cache to do this: add_action(‘save_post’,’custom_clear_wp_super_cache’); function custom_clear_wp_super_cache($post_id) { if (function_exists(‘wp_cache_clear_cache’)) {wp_cache_clear_cache();} } There may (or may not) be a method of flushing the cache for a particular post now.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)