diff --git a/mod/wiki/lib.php b/mod/wiki/lib.php
index <HASH>..<HASH> 100644
--- a/mod/wiki/lib.php
+++ b/mod/wiki/lib.php
@@ -171,7 +171,8 @@ function wiki_reset_userdata($data) {
             foreach ($subwikis as $subwiki) {
                 // Get existing pages.
                 if ($pages = wiki_get_page_list($subwiki->id)) {
-                    if (!empty($data->reset_wiki_tags)) {
+                    // If the wiki page isn't selected then we are only removing tags.
+                    if (empty($data->reset_wiki_pages)) {
                         // Go through each page and delete the tags.
                         foreach ($pages as $page) {
 
@@ -184,7 +185,7 @@ function wiki_reset_userdata($data) {
                             }
                         }
                     } else {
-                        // Delete pages.
+                        // Otherwise we are removing pages and tags.
                         wiki_delete_pages($context, $pages, $subwiki->id);
                     }
                 }
MDL-<I> mod_wiki: Fix for reseting pages and tags

This will ensure that both pages and tags will be
removed when all the reset options for the wiki are
selected.