Try our conversational search powered by Generative AI!

Delete Language Branch from All pages and site


Hi i want to delete a language branch from all pages where its used and from the website. On my site I have multiple language support over 1000 pages with I dont know exactly how many pages use polish (PL) language.I want to remove polish language. I just simply want to delet the language and all pages at once instead go page by page and delete polish individually and then from the site. I am unable to delete when i go to Admin>Config>Manage Website Languages I get this error

The language is used in language settings on the following pages and cannot be deleted: Root [1], Home [3]....

Deleting language from individual pages is not so option as there are so many pages in the website.

Can some one kindly help me out with this?

Aug 29, 2014 16:42

Not sure that's possible, at least nowhere in the UI.

Seems like you'd have to write a small job to loop through your pages and delete that specific language branch.

There are "delete language" methods in both the EPiServer.DataFactory and EPiServer.DataAbstraction.ContentStore namespaces, but they all take a PageReference or ContentReference as parameter, meaning they will only delete the language for the specified page, not all pages in the content tree.




Aug 31, 2014 0:23

Just for reference, I'm posting the updated solution by Adnan here:

Edited, Apr 01, 2015 0:20

The following code seems to work for me... Easy enough to wrap in an admin plugin.

var pages = _contentRepository.GetDescendents(ContentReference.RootPage);
var datafactory = new DataFactory();
foreach (var page in pages)
		datafactory.DeleteLanguageBranch(page, language, AccessLevel.Delete);
	catch (SqlException)
		// Ignore whether the page exists in the language or not
Apr 01, 2015 2:10
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.