Title: 4.3.1 high CPU usage
Last modified: August 30, 2016

---

# 4.3.1 high CPU usage

 *  [driftdigital](https://wordpress.org/support/users/driftdigital/)
 * (@driftdigital)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/431-high-cpu-usage/)
 * This plugin does work with the latest version of WordPress 4.3.1 BUT it yields
   high CPU usage.
 * I’m not a WordPress developer but with some debug plugins I tracked the high 
   CPU usage to this function, which queries the posts table on every page load.
   I dont know why it does this, but with 5k+ records in my posts table it slows
   everything down and hogs 1+ cores of the CPU while doing it.
 * Seems to install fine, htaccess rules are all there, but I dont understand why
   this sql query runs on every page. That’s what killed it.
 * public function rewrite_rules($flash = false) {
    global $wp_post_types, $wpdb;
   $suffix = get_option(‘uwt_permalink_customtype_suffix’); foreach ($wp_post_types
   as $type=>$custom_post) { if ($custom_post->_builtin == false) { $querystr = “
   SELECT {$wpdb->posts}.post_name FROM {$wpdb->posts} WHERE {$wpdb->posts}.post_status
   = ‘publish’ AND {$wpdb->posts}.post_type = ‘{$type}’ AND {$wpdb->posts}.post_date
   < NOW()”; $posts = $wpdb->get_results($querystr, OBJECT); foreach ($posts as 
   $post) { $regex = (!empty($suffix)) ? “{$post->post_name}\\.{$suffix}\$” : “{
   $post->post_name}\$”; add_rewrite_rule($regex, “index.php?{$custom_post->query_var}
   ={$post->post_name}”, ‘top’); } } } if ($flash == true) flush_rewrite_rules(false);}
 * [https://wordpress.org/plugins/remove-slug-from-custom-post-type/](https://wordpress.org/plugins/remove-slug-from-custom-post-type/)

The topic ‘4.3.1 high CPU usage’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/remove-slug-from-custom-post-type.
   svg)
 * [Remove slug from custom post type](https://wordpress.org/plugins/remove-slug-from-custom-post-type/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/remove-slug-from-custom-post-type/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/remove-slug-from-custom-post-type/)
 * [Active Topics](https://wordpress.org/support/plugin/remove-slug-from-custom-post-type/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/remove-slug-from-custom-post-type/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/remove-slug-from-custom-post-type/reviews/)

## Tags

 * [cpu](https://wordpress.org/support/topic-tag/cpu/)

 * 0 replies
 * 1 participant
 * Last reply from: [driftdigital](https://wordpress.org/support/users/driftdigital/)
 * Last activity: [10 years, 9 months ago](https://wordpress.org/support/topic/431-high-cpu-usage/)
 * Status: not resolved