WordPress.org

Support

Support » Plugins and Hacks » [Plugin: WP Super Cache] Preload Custom Post Types ?

[Plugin: WP Super Cache] Preload Custom Post Types ?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Donncha O Caoimh

    @donncha

    Nope, no way right now but if you’d like to modify the preload code I’ll gladly accept a patch!

    Adam Capriola

    @adamcapriola

    Here’s my edit…

    In wp-cache.php I changed line 2505 (or thereabouts) from:

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

    to

    if ( $wp_cache_preload_posts == 'all' || $c <= $wp_cache_preload_posts ) {
    		$posts = $wpdb->get_col( "SELECT ID FROM {$wpdb->posts} WHERE
    (post_type = 'post' OR post_type='page' OR post_type='MY_POST_TYPE') AND
    post_status = 'publish' ORDER BY post_date DESC LIMIT $c, 100" );

    Basically I all I did was add OR post_type='MY_POST_TYPE'. I’m honestly not sure if it worked or not, but I think that’s right!

    Plugin Author Donncha O Caoimh

    @donncha

    Yeah, that’ll work for your custom post type. The problem is adding that as a variable on a settings page. I could try filtering out things that are NOT to be cached – like inherited records and others but I’m 100% positive that will cause problems for someone else. 🙁

    Plugin Author Donncha O Caoimh

    @donncha

    I just updated the development version so it grabs every post EXCEPT FOR revisions and nav menu items. Can you give the development version on the download page a go?

    Sure thing, just installed it. Hopefully it works! 🙂

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Plugin: WP Super Cache] Preload Custom Post Types ?’ is closed to new replies.