• Resolved jimihenrik

    (@jimihenrik)


    Basically I want to do the same that the admin bar button does but

    $vc = new VCaching();
    $vc->purge_cache();

    doesn’t seem to do the trick, how should I trigger it?

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Razvan Stanga

    (@razvanstanga)

    That should do the trick.

    Plugin Author Razvan Stanga

    (@razvanstanga)

    Also take a look at wp-cli.php

    
    /**
     * Purges Varnish Cache
     */
    class WP_CLI_VCaching_Purge_Command extends WP_CLI_Command {
    
        public function __construct() {
            $this->vcaching = new VCaching();
        }
    
        /**
         * Forces a Varnish Purge
         *
         * ## EXAMPLES
         *
         *     wp vcaching purge
         *
         */
        public function purge() {
            wp_create_nonce('vcaching-purge-cli');
            $this->vcaching->purge_url(home_url() .'/?vc-regex');
            WP_CLI::success('ALL Varnish cache was purged.');
        }
    
    }
    
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to trigger full purge from code’ is closed to new replies.