Skip to main content
Inspiring
May 11, 2026 9:14 AM UTC
Open for Voting

The option to hide linked layers

A simple request really. If there’s a linked layer, for example an tomato and a shadow, so you can move them about together amongst other images. If it gets hidden the shadow should also be hidden at the same time. It should be a simple toggle switch or icon.

6 replies

Stephen Marsh
Community Expert
Community Expert
May 14, 2026 6:17 AM UTC

​@GazzaBrad 

 

The following script toggles the visibility of an active layer and all linked layers.

 

 

/* 
Toggle Linked Layer Visibility v1-0.jsx
Stephen Marsh
v1.0 - 14th May 2026
https://community.adobe.com/feature-requests-713/the-option-to-hide-linked-layers-1561098
*/

var activeID = getActiveLayerID();
var linkedIDs = getLinkedLayerIDs(activeID);

if (linkedIDs.length === 0) {
alert("The active layer has no linked layers!");
} else {
// Use the active layer's visibility to determine toggle direction
var currentVisibility = isLayerVisible(activeID);
var newVisibility = !currentVisibility;
// Toggle the active layer
setLayerVisibilityByID(activeID, newVisibility);
// Toggle each linked layer to match
for (var i = 0; i < linkedIDs.length; i++) {
setLayerVisibilityByID(linkedIDs[i], newVisibility);
}
var state = newVisibility ? "Visible" : "Hidden";
app.beep();
//alert(state + ": " + (linkedIDs.length + 1) + " linked layer(s).");
}


///// Functions /////

function getLayerDescriptor(id) {
var ref = new ActionReference();
ref.putIdentifier(charIDToTypeID("Lyr "), id);
return executeActionGet(ref);
}

function getActiveLayerID() {
var ref = new ActionReference();
ref.putEnumerated(charIDToTypeID("Lyr "),
charIDToTypeID("Ordn"),
charIDToTypeID("Trgt"));
var desc = executeActionGet(ref);
return desc.getInteger(stringIDToTypeID("layerID"));
}

function getLinkedLayerIDs(layerID) {
var desc = getLayerDescriptor(layerID);
var linkedIDs = [];

if (desc.hasKey(stringIDToTypeID("linkedLayerIDs"))) {
var linkedList = desc.getList(stringIDToTypeID("linkedLayerIDs"));
for (var i = 0; i < linkedList.count; i++) {
linkedIDs.push(linkedList.getInteger(i));
}
}
return linkedIDs;
}

function isLayerVisible(layerID) {
var desc = getLayerDescriptor(layerID);
return desc.getBoolean(charIDToTypeID("Vsbl"));
}

function setLayerVisibilityByID(layerID, visible) {
var ref = new ActionReference();
ref.putIdentifier(charIDToTypeID("Lyr "), layerID);

var desc = new ActionDescriptor();
desc.putReference(charIDToTypeID("null"), ref);

var action = visible ? stringIDToTypeID("show") : stringIDToTypeID("hide");
executeAction(action, desc, DialogModes.NO);
}

 

  1. Copy the code text to the clipboard
  2. Open a new blank file in a plain-text editor (not in a word processor)
  3. Paste the code in
  4. Save as a plain text format file – .txt
  5. Rename the saved file extension from .txt to .jsx
  6. Install or browse to the .jsx file to run (see below for more info):

https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html

 

Once installed, a custom keyboard shortcut can be applied to the script, or, you can record the script execution into an action and run from the action panel or action F-key shortcut.

 

 

Translate
GazzaBradAuthor
Inspiring
May 14, 2026 1:19 PM UTC

That’s exactly what I was looking for Stephen, thanks a lot. Sometime the shadows need to be down the layer order and not grouped because they’re shadows on a surface. For instance, fruits/veg will have their own clipped shadows between each other and then under a whole group will be surface shadows. This will be perfect for that.

Translate
CShubert
Community Manager
Community Manager
May 13, 2026 8:00 PM UTC

Hi ​@GazzaBrad in Ps Beta right now we have a layer cleanup feature which might be what you are looking for.  Download it and give it a try and let us know what you think or if something else is needed.

 

 

Thanks,

Cory - Photoshop Product Manager

Translate
D Fosse
Community Expert
Community Expert
May 11, 2026 11:46 AM UTC

You can already do that.

 

You can group them (ctrl+G), then hide/show the group.

Translate
GazzaBradAuthor
Inspiring
May 12, 2026 6:56 AM UTC

Yeah, I’m aware of that but I have shadows further down the layer order that need to keep together in separate groups.

Translate
Stephen Marsh
Community Expert
Community Expert
May 14, 2026 5:16 AM UTC

Whether Adobe act on this feature request or not,  at least in the short term it would make sense to group the parent layer and the child layer in a group so that they behave as a single element.

 

I’ll look to see if the relationship between a “parent” layer and linked “child” layer/s is accessible to scripting.

 

EDIT: Apparently there's no parent/child relationship, but the linked property is available to scripting!

Translate