First, give them plenty of other opportunities to find stuff out. Can they sneak up on the goblins and listen to them talk? Can the one who speaks orc pretend to get captured and listen in, giving a signal to their friends for rescue when they’ve learned the plans? Do the guards carry their orders with them written down, even if it’s in code? Can they rescue someone who’s overheard their captors’ plans?
It would also work to use the The Dark Knight solution: give them information, but teach them that information obtained via torture is highly unreliable. Either the captive is vindictive and gives them false or misleading information to spite them, or they’re scared and intimidated and will say anything to make them stop the torture, whether they know the truth or not. Make it clear why the information is unreliable so they learn that what they’re doing is awful, not just ineffective.
Another option is to use NPC reactions: have a NPC witness their behaviour, or ask them how they learned secret enemy information, and have them react appropriately when they learn how the party got it. Alternatively have NPCs they rescue have heard about the party’s behaviour, perhaps even from their captors, and be frightened to travel with them. This might mean they’re wary around them, or if they see first hand their tactics, perhaps they run away or try and sneak off during the next rest.
Something else I’ve learned in these situations is to give the players a clear chance and path to redemption. If you haven’t had the out of character conversation or you want to find an excuse to have it, it helps to turn the story consequences into a good story opportunity, rather than just punishing behaviour you find gross (as do I) and they presumably (hopefully) haven’t thought too deeply about. So have the NPC they’re talking to put a hand on their shoulder and tell them this is not the way. Have the one who is with them when they go to cut something off a victim give the orc a clean death and tell them there are more honourable paths.
And, at the end of the day, have the out of character conversation where you explain that you know it’s not real and no-one’s really getting hurt, but in a game where they can literally choose to do anything, note that they are repeatedly choosing to imagine torture. Be upfront that this is not something you are okay with; if they really want to go there, that’s their prerogative, but they might need a new GM. It might help to walk this back to session zero chat and draw up some lines and veils, or introduce the X-card - these techniques are not just for players, but for GMs too.