Drupal 8/9 publish or unpublish nodes of specific content type using cron

When the Drupal cron runs, the hook_cron() is triggered. As a result, we can define our task within this.

Example1: if there are any unpublished nodes present in the article content type, I want to publish them every time the cron runs.
Example2: if there are any published nodes present in the article content type, I want to unpublish them every time the cron runs.
copy-icon

Comments

Authors

Read Next