Delete courses

Admin tools ::: tool_deletecourses
Maintained by Picture of Charles FultonCharles Fulton, Picture of Andrew ZitoAndrew 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:
389 sites
13 fans
Current versions available: 5

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


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

Comments RSS


  • Picture of Charles Fulton
    Sat, Aug 25, 2018, 10:18 PM
    Hi Bert,

    It's accessed via the category administration page. See for details.

  • Picture of Owen Grubbs
    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.
  • Picture of Shaun T
    Thu, Nov 8, 2018, 2:43 AM
    Would it be possible to have it run scheduled vs adhoc? What changes would be necessary?
  • Picture of Charles Fulton
    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?
  • Picture of Shaun T
    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.
  • Picture of Charles Fulton
    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:
  • Picture of Asher Baig
    Sat, Jun 20, 2020, 3:28 AM
    How to find your tool?
  • Picture of Barry Matthias
    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?
  • Picture of Charles Fulton
    Fri, Jun 26, 2020, 1:21 AM
    Hi Barry, that's a good idea and I've logged it here:
  • Picture of Barry Matthias
    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.
  • Picture of Charles Fulton
    Sat, Jul 11, 2020, 1:39 AM
    Please see the README for instructions on using the tool with Boost:
  • Picture of Alain Raap
    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?
  • Picture of Charles Fulton
    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.


  • Picture of Alain Raap
    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?
  • Picture of Susana Willemoës
    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.
Please login to post comments