Created
December 31, 2020 05:16
-
-
Save arpitr/f61623f35527d8e8f3712d9e73a358ae to your computer and use it in GitHub Desktop.
Delete Media Entities of certain type
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Change the bundle that needs to be deleted. | |
drush php-eval '$ids = \Drupal::entityQuery("media")->condition("bundle", "image")->execute();$storageHandler = \Drupal::entityTypeManager()->getStorage('media');$entities = $storageHandler->loadMultiple($ids);foreach ($entities as $entity) {$entity->delete();}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment