Drupal 8: Remove all paragraphs entities from the site programmatically

23 Aug.2019
drupal paragraphs

Sometimes we need to completely remove paragraphs entities, for example, when you copy a site for another project.

You can use custom code in your custom module or install devel_php and run with admin interface on /devel/php.

use Drupal\paragraphs\ParagraphInterface;
use Drupal\paragraphs\Entity\Paragraph;
$ids = \Drupal::entityQuery('paragraph')->execute();
foreach ($ids as $id) {
  $paragraph = Paragraph::load($id);
  if ($paragraph instanceof ParagraphInterface) {