Site icon Hip-Hop Website Design and Development

How do I create a link in the WP admin bar that purges all caches (W3 Total Cache)?

I’m trying to create a link in the top admin bar with a single link to purge all caches. However, after awhile the nonce expires. How can I make this work?

function add_toolbar_items($admin_bar){
    global $wp_admin_bar, $current_user;

    if ($current_user->ID == 1)

    $admin_bar->add_menu( array(
        'id'    => 'purge-all-caches',
        'title' => 'Purge All Caches',
        'href'  => '/wp-admin/admin.php?page=w3tc_dashboard&w3tc_flush_all&_wpnonce=ce99c46c21',
        'meta'  => array(
            'title' => __('Purge All Caches'),            
        ),
    ));

}
add_action('admin_bar_menu', 'add_toolbar_items', 100);