How to check if a referenced entity is being used in other places? I have a paragraph component that has a single field (reference) that calls on other paragraph components. I'd like to remove one of the paragraph reference field options so that users do not accidentally select it, however, when I do this I start receiving errors across my multisite environment that a reference no longer exists. Is there a quick way to check if a paragraph (or any entity) is being used and in which places (preferably one that shows paths) so that I can remove the reference before deleting this paragraph reference option from my paragraph component?

Any and all assistance would be greatly appreciated, thanks!
Is there a quick way to check if a paragraph (or any entity) is being
  used and in which places (preferably one that shows paths) so that I
  can remove the reference before deleting this paragraph reference
  option from my paragraph component?


A paragraph can only be used in one place. So I'm first answering the part "or any entity", which also reflects the question title, and address the paragraphs specifics later.

I would do this in two steps. First find all entity reference fields which are configured to target this entity type, then run an entity query for each field.

As example how to find all entities where term #1 is used:

use Drupal\field\Entity\FieldStorageConfig;

$target_id = '1';
$target_type = 'taxonomy_term';

$map = \Drupal::service('entity_field.manager')-&gt;getFieldMapByFieldType('entity_reference');
$results = [];
foreach ($map as $entity_type =&gt; $fields) {
  foreach ($fields as $field_name =&gt; $field) {
    // we are only interested in configured fields, not base fields
    $config = FieldStorageConfig::loadByName($entity_type, $field_name);
    if ($config &amp;&amp; $config-&gt;getSetting('target_type') == $target_type) {
      $ids = \Drupal::entityQuery($entity_type)
        -&gt;condition($field_name, $target_id)
        -&gt;execute();
      $results[$entity_type][$field_name] = $ids;
    }
  }
}


If the field is configured in a paragraph type, the IDs you find are of paragraph entities. Load the paragraph and get the parent entity with $paragraph-&gt;getParentEntity(). For nested paragraphs do this multiple times, until you find a non paragraph entity, for example a node.