public function setPermalinkStructure($wp_rewrite, $structure)
    {
        // Set the new permalinks structure
        $wp_rewrite->set_permalink_structure($structure);
        // Flush the rules and tell it to write htaccess
        $wp_rewrite->flush_rules(true);

        // Clear the rewrite rules options cache
        update_option("rewrite_rules", false);
    }