How do WordPress developers keep their premium themes from being pirated and distributed for free?
You don’t and you can’t. Honest.
*Takes a deep breath and thinks “this will probably get this topic closed, possibly by me personally.”*
Here’s the thing and this was settled long ago in 2009 (it really and truly was), the PHP code in WordPress themes is GPL licensed. The CSS and js could be GPL’ed too, but that’s really dependent on a few things.
Themes are GPL, too
What that means is that you, the developer, cannot restrict users from sharing GPL’ed code. The license explicitly forbids that. That does not mean that you can’t sell your themes, it does mean that you can’t stop users from sharing that code.
The concept of “Software Piracy” does not exist with GPL’ed code. It’s not “piracy” or “stealing” when someone takes that code and distributes it. That’s how it is with GPL’ed code. It’s not wrong or even unethical to distribute GPL’ed code. Themes fall into that category because they inherit the GPL from WordPress.
The only solution I have come across is using licensing keys and was wondering if there are better solutions.
There are developers who obfuscate and “protect” their code with license keys, and that conversation isn’t for these forums. That’s against the whole philosophy of WordPress.
https://www.ads-software.com/about/philosophy/
Scroll down to the bottom, it’s the part labeled “Our Bill of Rights”.
Theme shops do make money and are often successful. It’s not easy, but they are able to pull it off by getting customers who rely on them for a steady stream of good product and good support. That’s worth paying for and has been demonstrated to be a working business model.