'object', 'subtype' => 'blog', 'limit' => 0, ); $batch = new \ElggBatch('elgg_get_entities', $options); foreach ($batch as $entity) { if (!$entity->status) { // create metadata owned by the original owner create_metadata($entity->getGUID(), 'status', 'published', '', $entity->owner_guid, $entity->access_id); } } elgg_set_ignore_access($ia);