• In wp-cache.php, on line 2390, you select all ID from the table posts where post_status is “publish” when caching in preload mode:

    $posts = $wpdb->get_col( "SELECT ID FROM {$wpdb->posts} WHERE post_status = 'publish' ORDER BY post_date DESC LIMIT $c, 100" );

    Thing is, not all items where post_status is “published” are of post_type = “post”, but also of post_type = “nav_menu_item”.

    Caching nav_menu_item will generate a 404 error and slow things down. post_name for nav_menu_item is always the same as ID, that is a number.

    To solve this, WP Super Cache must also check that post_type = “post” in its SQL statement:

    $posts = $wpdb->get_col( "SELECT ID FROM {$wpdb->posts} WHERE post_status = 'publish' AND post_type='post' ORDER BY post_date DESC LIMIT $c, 100" );

    https://www.ads-software.com/extend/plugins/wp-super-cache/

  • The topic ‘[Plugin: WP Super Cache] Nav items cached in preload’ is closed to new replies.