UE4 Outline Post process through the wall

Check this post, this is how you solve it, you need to subtract the scenedepth from your customdepth, so the outline only shows when that pixel from the outline is not occluded by something else.
https://forums.unrealengine.com/t/how-to-hide-outline-post-process-effect-behind-objects/335022/3

In your material screenshot, you have 5 SceneTexture:CustomDepth nodes, the one in the middle, goes into 4 subtract nodes, always on the A node.
And then you have 4 SceneTexture:CustomDepth nodes that go into the B node of each subtract… You need to replace those 4 SceneTexture:CustomDepth for 4 SceneTexture:SceneDepth, just click on each, and on the left, change from custom depth to scene depth. that will solve your issue!