diff --git a/core/model/SiteTree.php b/core/model/SiteTree.php index 29c1c1e5f..cea439468 100755 --- a/core/model/SiteTree.php +++ b/core/model/SiteTree.php @@ -1373,6 +1373,13 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid $page->write(); } + // Also write all VPs pointing here + $suffix = Versioned::current_stage() == 'Live' ? '_Live' : ''; + foreach(DataObject::get('VirtualPage', "SiteTree$suffix.ID = SiteTree$suffix.ID AND CopyContentFromID = {$this->ID}") as $page) { + // $page->write() calls syncLinkTracking, which does all the hard work for us. + $page->write(); + } + parent::onAfterDelete(); }