Let's say you have a need for the following:

  • Content is created with content moderation, with various states.
  • After a set amount of time, the content is deleted or archived.
  • The user can set when media (using the media module) can be unpublished.
  • When the media is unpublished, it's truly gone from the system. Meaning, if you already knew the path of the file before (like example.com/site/default/files/blah.pdf), then after it has been unpublished, it can no longer be accessed because it's gone from the file system.

Playing around with content moderation, I can get it to published in a scheduled manner, but unpublishing seems to not be as straight forward. And media, well, that seems to stick around forever unless you truly delete it.

What am I missing? If this isn't a part of the contributed modules, what other options are there?


1 Answer 1


It should be no problem for a module to implement a cron hook to unpublish content and media after a set amount of time.

Concerning the media files, if you want that they can no longer be accessed after unpublishing the media entity you have store them in the private file system configured in settings.php. See


The public file system example.com/site/default/files can be accessed through the web server directly without Drupal being involved.

  • Alrighty, this makes sense to go the private route for these files with Media. That link was helpful, thank you. As for the other issue, I didn't have all the correct modules added to have unpublish with moderated content. All is good now, thanks! I'll give the private file system a shot for this build. Aug 16, 2020 at 17:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.