I found some functions that I want to get from WordPress source code and add wan
ID: 660407 • Letter: I
Question
I found some functions that I want to get from WordPress source code and add want to add them into my project which is going to be open source.
Do I simply get the functions that I want and add them to my project with a little comment saying that I got it from WP like:
/**
* Author: WordPress
**/
or is there anything else I have to consider before getting the code?
Also, is there anything else apart from the above question that I have to consider if I want to sell to someone my project with these functions?
Explanation / Answer
Generally if you take code from a GPL project and re-use it in anyway, and then redistribute that code (as it appears you intend to do by open sourcing your derived work), then your code must adhere to the GPL as well. In other words, your entire project will also need to be licensed under the GPL. Sounds crazy I know. But if that doesn't bother you, then you should feel free to use and re-use code to your hearts content.
Personally, I would package those functions you borrow from WordPress in a separate file. That way you keep a clear separation between your code (which you own the copyright to) and WordPress' code (which you do not own the copyright to). That way in the future you could easily replace the functions you borrowed with functions you author yourself, allowing you more freedom in how you license your project.
In the file that contains all of the functions borrowed from WordPress, make sure you clearly call out that the file contains code borrowed from WordPress. If you can indicate the version of WordPress it was borrowed from and the line numbers it was pulled from. What you want to do is be as transparent as you can about where code comes from, and/or how you have modified it. That is helpful not only to you later on, but also to the WordPress folks in case they want to understand the changes you made and reintegrate them back into their source code. I might have a header that looks something like this:
/*
* This file contains code that was borrowed from WordPress.
*
* This is free software: you can redistribute it and/or modify it under the terms of
* the GNU General Public License version 2 as published by the Free Software
* Foundation.
*
* This software is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* Copyright: mixed. See WordPress.org for copyright and licensing information.
*/
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.