Is there a way to make a wireframe block stuff behind it?

I’m trying to render just a wireframe mesh, but where it overlap I can see stuff through the mesh. I don’t want to be able to view through it. Is this possible?

Reason I need to do this, is because the wireframe is creating z-fighting with a mesh, and I can’t use polygonoffset for the object, because then you can see the wireframe intersecting oddly with the object (picture shown below).

So I think I need to render the wireframe separately… however, when separated, it renders so that I can see through the wireframe.

I need it so that it still renders with depth buffer of the object at same position as the wireframe (so that stuff behind isn’t rendered)… But when I keep the depth buffer, there is z-fighting due to the wireframe sitting ontop of the mesh…

So I either have the z-fighting, or I have the odd intersections… I’d prefer if I solved both!

Here’s the issue I’m trying to solve. You can see with offsetpolygon for the texture, the wireframe displays oddly where the mesh intersects.
wireframeoffset