Delete all labels from all direct child pages of a parent page
You need to install the Power Scripts for Confluence app in your Confluence Server/DataCenter instance to implement the below.
The below SIL script will delete all labels from all the direct child pages of the selected parent page in a Confluence Server/DataCenter instance:
//get the id of the parent
number parent = getPage("TST", "This is a demo parent page");
//get the ids of the direct children
number [] children = getChildPages(parent);
//loop through children
for(number child in children) {
//set the labels to empty string -> which deletes all labels of the page
%child%.labels = "";
}
Replace
TST
with the key of Space where the parent page exists.This is a demo parent page
with the title of the desired parent page.
Note: If you have utilized these labels in any macro that involves labels (for example, the Content by Label macro), deleting those labels may cause the above child pages to be excluded from the macro-generated results.
Example
Here’s an example showing the above script in action:
Reference
See Other Recipes: