• 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://ww.wp.xz.cn/plugins/remove-slug-from-custom-post-type/

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