WordPress.org

Support

Support » Plugins and Hacks » [Plugin: WP Super Cache] function to delete homepage or category page (not post)

[Plugin: WP Super Cache] function to delete homepage or category page (not post)

  • Hi,

    On my site, I have some administration options that allows to manually set up the display of the posts on the homepage and the main category pages. When the editor finishes selecting the posts and formatting them, he clicks ‘publish’ and that generates the homepage or the specific category page he was editing.

    I wanted to add to this process an action to delete the cached version of that page. I tried simply adding do_action( ‘gc_cache’, ‘prune’, ‘homepage’ ) – but it did nothing. I also tried other methods that I came across in the WP Super Cache class, but they don’t work. I’m obviously missing something.

    Can you point me in the right direction please?

    Many thanks,

    Bira

    http://wordpress.org/extend/plugins/wp-super-cache/

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

    @donncha

    you’ll probably want to do something like

    prune_super_cache( get_supercache_dir() . '/category/' . $category . '/' );

    where $category is the category you want..

    Yep, that worked. Thank you 🙂

    For the homepage I did:
    prune_super_cache( get_supercache_dir() . ‘/index.html’ );
    prune_super_cache( get_supercache_dir() . ‘/index.html.gz’ );

    I guess there’s no quicker/shorter way than that?

    Plugin Author Donncha O Caoimh

    @donncha

    You’ll probably want to use something like this too, and foreach() over the filenames as there might be more than just those 2 filenames.

    $files_to_check = get_all_supercache_filenames( $dir );

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: WP Super Cache] function to delete homepage or category page (not post)’ is closed to new replies.