Delete courses

Admin tools ::: tool_deletecourses
Maintained by Charles Fulton, Andrew Zito
This admin tool allows managers to delete all courses in a category (including subcategories if desired). The tool may optionally bypass the recycle bin for improved performance.
Latest release:
494 sites
14 fans

This admin tool allows managers to delete all courses in a category (including subcategories if desired). The tool may optionally bypass the recycle bin for improved performance. It uses an Adhoc task to process the actual deletions and requires cron to be enabled.


Screenshot #0
Screenshot #1


Charles Fulton (Lead maintainer)
Please login to view contributors details and/or to contact them

Comments RSS

Show comments
  • Thu, Oct 18, 2018, 2:47 AM
    I also can't seem to find the tool once installed, even after looking at the github instructions. Can you provide a screen shot showing what I should see in the category administration page? Thanks.
  • Thu, Nov 8, 2018, 2:43 AM
    Would it be possible to have it run scheduled vs adhoc? What changes would be necessary?
  • Thu, Nov 8, 2018, 2:44 AM
    Shaun T, it could be done, but it would be a fundamentally different plugin. What are you trying to accomplish?
  • Thu, Apr 11, 2019, 5:29 AM
    Sorry Charles, I mssed your comment. We use a custom middle ware application to move courses to a deleted category and then delete them once a day. However sometime there are so many courses to delete the connection between our middleware and moodle times out. I'm looking for something that will delete all the courses in a specific category daily.
  • Sat, Apr 13, 2019, 3:01 AM
    Shaun T: Gotcha, that's an interesting use case. Effectively you want Moodle categories to have a concept of a retention policy, with it being something other than indefinite in one use case. I could see accomplishing that within this plugin. I've logged your suggestion here:
  • Sat, Jun 20, 2020, 3:28 AM
    How to find your tool?
  • Wed, Jun 24, 2020, 5:25 PM
    Can you add a cli feature for this module so it can be ran from the command line?
  • Fri, Jun 26, 2020, 1:21 AM
    Hi Barry, that's a good idea and I've logged it here:
  • Thu, Jul 9, 2020, 12:01 AM
    Afternoon Charles

    I also doubled up on this deletion issue and charged this with Moodle HQ
    i do think however this module would be a better solution rather than waiting for Moodle HQ to implement something.
  • Sat, Jul 11, 2020, 1:39 AM
    Please see the README for instructions on using the tool with Boost:
  • Fri, Oct 2, 2020, 4:17 PM
    Hi, Charles

    When will your cli version be available? Is it also possible to select courses that aren't used anymore befory a given date? And is your plugin working in Moodle 3.9?
  • Fri, Oct 2, 2020, 9:55 PM
    Hi Alain,

    The current version was tested with Moodle 3.9 and works. There's no date for the cli version; I still think it's a good idea but I've no time to work on it. Regarding selecting courses based on date, there's no such functionality and no current plans to include it.


  • Mon, Oct 5, 2020, 6:58 PM
    Hi Charles,

    Thanks for you message. I tried to install the plugin, but I can't see a button in the course administration to delete the courses.
    Do you have an example where I can find it?
  • Wed, Apr 7, 2021, 8:20 PM
    Hi Charles,
    Thank you for the plugin.
    I ve installed it in Moodle 3.5.2+, correctly found the link Delete all courses in my category, run manually the cron.php and see only one adhoc task "Execute adhoc task: core_course\task\course_delete_modules" , but courses are not deleted, they still appear in the list. What can be the problem? I've denyed the access to the link to manager rol too, so it is only visible to main managers.
  • Thu, Oct 7, 2021, 2:49 PM
    The plugin is not an option on the courses and categories page. You would need to navigate to the category via this link: https://[YOUR SITE]/course/index.php?categoryid. Click on the category to delete and then click the gear icon to manage the category. Select the option for Delete all courses.
    After you click on 'Delete all courses' you will then have the option to include subcategories and bypass the recycle bin. Bypassing the recycle bin will also help speed up the deletions.
1 2
Please login to post comments