Forums

Calling the Delete method of WP Super Cache from a PHP script (4 posts)

  1. brockangelo
    Member
    Posted 1 month ago #

    I am building some forms into a template that would change custom fields for a page on our company intranet. I would like to delete the cache whenever an administrator submits the form so that when the page reloads, it will show the new value of the custom field.

    Is there a way to delete the cache from a php script? It looks like I could call wp_cache_clean_expired from the php script, but I haven't found any documentation on using this function for that purpose.

  2. donncha
    Member
    Posted 1 month ago #

    You can try the following:
    prune_super_cache( $blog_cache_dir, true );
    prune_super_cache( $cache_path . 'supercache/', true );

    I'm going to add a new function, wp_cache_clear_cache() that will call those functions but in the current version you have to use the 2 functions above.

  3. brockangelo
    Member
    Posted 1 month ago #

    That did the trick.
    Thank you donncha!

    I'm curious, will the new function have any parameters?

  4. donncha
    Member
    Posted 1 month ago #

    No, check out the development version on the download page. You'll find the function already there.

Reply

You must log in to post.

About this Topic