My situation: I have build a few simple ("procedural") WP plugins by now, and now I want to move my plugin skills to a higher, advanced level
In my WP plugin handbook I read: "In order to avoid conflicts with other WP plugins or WP itself; prefix everything!" Which is of course a very good idea for the mentioned reason. But at the same time I'm trying to find a way to limit the prefixing to only the parts where it is really necessary. Since 'everything' is a lot.
There are two reasons why I try this:
- All this prefixing doesn't do much good to the readability of my code
- I'm busy building my own plugin foundation and I want to limit search/replace when adding a plugin specific prefix to the entire project later on as much as possible. (Or is there some nifty other way to do this?)
Anyhow, As I see it now, it's important to prexif everything EXCEPT:
- Vars inside functions which don't have a global scope
- vars/properties inside classes
- functions/methods inside classes
(Class names themselves however do need to be prefixed because they are used upon instantianation of the objects.) The reason for my assumption is that these exceptions are being used inside a function name or object handler which is already prefixed.
My first question is: are my assumptions right?
My second(ary) question is: are there smarter ways to handle my objections against 'too much' prefixing, in the scope of my situation?