From time to time, the GPL comes up in less-than-friendly conversation regarding WordPress.  Everyone has their own opinion of what the license means, and strings of "but I am not a lawyer" litter every discussion.  This turns any lively discussion into a heated debate because "well this is what I think" quickly turns into "you're not a lawyer, so you're wrong, but even though I'm not a lawyer, this is the way it is."

The result is a very frustrated WordPress user base, a cluttered mailing list, tickets opened on Trac that do nothing more than piss off developers, and a community of new-to-WordPress-development users who don't want to get involved at all.

So here is a five-minute overview of exactly what the GPL means for your WordPress development:

Why is WordPress GPL at all?

WordPress is a fork of a pre-existing blog platform called b2 cafelog that was, itself, licensed under the terms of the GPL.  This is what gave Matt Mullenweg and company the ability to fork b2 in the first place:

1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program.

You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.

2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above [...]

In laymen's terms: If you receive a program that is licensed under the terms of the GPL, you also receive permission to re-distribute that program as-is or to modify it in any way and re-distribute your modified version as well.

It's actually a pretty powerful license.  It means that anyone who has a copy of WordPress can re-publish the source code in any way they like and do with the code anything they like.  This is the founding principle of "free and open source software" (FOSS).  You are "free" to modify the software, free to give the software away, and free to charge for distributing the software.  The basic requirement, though, is that you have to make the source code of the software available to anyone you give the software to.

Why do I have to make the source code available?

The requirement for being able to distribute a program that's licensed under the GPL is that anyone who receives it has the same rights you had when you received it.  With WordPress specifically, you receive the right to modify and redistribute the source code - so anyone you give your version of WordPress to must also receive the right to modify and redistribute the source code.

This doesn't mean you have to ship the source code, though.  JavaScript, a language most of us use to build interactive front-ends for websites, is code that can be easily "minified" (you strip out whitespace, make object and variable names very small, and essentially make the source code unreadable).  Let's say you write a piece of JavaScript code and give it away under the terms of the GPL.  The recipients of your code must have the right to also receive the source code - you must either also give them a development (non-minified) version, an offer to give them the source code at no additional cost (valid for at least 3 years), or information you received about the source code's availability (assuming the code was initially written and distributed by someone else).

3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following:

a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,

b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,

c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.)

Can I obfuscate the code but still distribute it?

A lot of developers like the idea of obfuscating their code to make it harder to pirate and re-distribute.  But that goes against the principle of the GPL - that anyone who receives a copy receives the same rights to distribute the code.  The GPL even speaks specifically about code compilation (which is what some people consider obfuscation, particularly with JavaScript and tools like Closure Compiler):

The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.

Even if you could somehow write and edit base64 encrypted code by hand, making a normal-person-editable version of the source available is fair, transparent, and will earn you far more respect in the community.

How can I make money from FOSS code?

This is the tricky part.  You can charge a fee for distributing your product.  You can also charge a fee for supporting you product.  But remember, you can't restrict the rights of your customers.  Anyone who buys your theme or plug-in immediately has the right to re-distribute that theme or plug-in for free to anyone, anywhere, for any reason.  At the same time, though, you do not have any obligation to support the third party.

Consider this:

Person A develops an outstanding theme framework for WordPress and wants to sell it.  They post descriptions and a demo online and, shortly thereafter, Person B purchases the framework.  Two days later, Person B gives the framework away to Person C for free by emailing a ZIP of the source code.

As much as this situation might frustrate you, no one has broken any rules.  So you're asking, if Person C can get the theme for free, why would anyone pay for it?

Simple.  Consider the following:

Person B can't figure out how to add a new sidebar widget to the theme.  Since they're a paying customer, they email Person A and ask for help.  Person A responds, helps them fix it, and both are happy.  Later, Person C has the same problem and also contacts Person A for help.  Person A asks why they haven't paid for support and declines the support request.

Distributing an open source system does not obligate you to support it. If you provided the original source code of your system with the original distribution, you have no obligations whatsoever - even if the recipient redistributes the system.

But you can charge for backup copies (similar to charging for the initial distribution). You can also charge for support. You can also charge for priority updates - just because you write a new version of the software doesn't mean you're required to distribute it to everyone for free.

But if anyone can re-distribute a premium system, why pay in the first place?

The biggest difference between a good system and a bad system isn't the quality of code. It's in the availability of support and the frequency of feature updates. If your system is sitting on a web server somewhere for 6 months without an update, why would anyone want to pay for it anyway?

Try to drop the paradigm of paying for the software package and adopt one of paying for support and updates. It's more maintainable and protects you from the very likely eventuality that one of your customers will give your shiny new system away for free.

Does my theme/plug-in have to be GPL?

Yes and no, and it depends entirely on what you do with it. If you only ever plan on using the theme or plug-in on your own site, there's no implicit license at all - licenses apply to the right of the license-holder to do something with the system. If you're the developer and you're the only one using the code, there's no need to license it to yourself.

However, if you distribute the code at all (give it away, sell it, deliver it to a client, post part of the code on your blog, etc.), then it must be licensed in a fashion compatible with the GPL. No plug-in or theme can run on its own - they require WordPress in order to operate, tie in with WordPress core code, and run as a part of WordPress when being used. This means they are derived from WordPress, and derivative works must carry the same license as the work from which they are derived.

Disclaimer

And now the obligatory disclaimer. No, I am not a lawyer. However, I have been working in the open source community for several years and have published systems under various versions of the GPL as well as other FOSS licenses. I can't guarantee that every suggestion or judgement I've made will stand up in a court if tested, but I can say with a certain amount of confidence that these are the safe avenues.

If there's a fine line between compliance and non-compliance it's easy to flirt with it a bit and stay in the clear. With the GPL, though, it's a very blurry line - it's safest to stay as far away from the realm of non-compliance as possible so that if and when the line is tested and refined, you won't find yourself on the wrong side of it.