If I release some code that I wrote myself with an Open Source license (a WordPress plugin with the GPL2 license, https://www.gnu.org/licenses/gpl-2.0.html), can I then use my own code in commercial software?
Law Stack Exchange is a question and answer site for legal professionals, students, and others with experience or interest in law. It only takes a minute to sign up.Sign up to join this community
If it's your code (and you're not using someone else's released under a GPL version), you can release it as you like under what terms you like under whatever licenses you like. There are no restrictions on what you can do.
One common model is to provide a "community edition" under the GPL and sell the right to use the software with a more commercial license to people who want to incorporate it in their closed-source software. MySQL used this model for some time.