Well, best practices wouldn't edit the core WordPress files at all but make any changes via the theme's functions file or plugins.
Doing it via the theme's functions file or a plugin means you spend the time once and can update WordPress core with no issues - doing it in the core WordPress files means you spend time everytime WordPress updates to make your changes again.
I have cornered myself **one time** doing this. I really do regret it. If you have a choice, find another way, now.
If not, document **everything** you changed and save it in a file somewhere easy to find, name it "wordpress-core-mods.txt" or something. You won't remember what you changed in the future. Also when updates come down, the line numbers will change, so the line number is not a good way to identify where the change now is. I did it like this:
around line 348, change this line (or chunk of code)
// whatever the line WAS
// what you changed it to
There really is no other way I can think of, and it's really a pain in the patootie. If you save your modified file and just replace it in the update, it may break Wordpress completely.
I'd almost rather put the code in an external and include it than do that again. :-\
rocknbil - I've had to do that on another cms because there wasn't a way around it at the time - it's not fun, and the only way was to document it like you said - find "chunk of code" and change to "something". Commenting your changes helps, but only a little. Much less headache, in the long run, to find another way.
Thanks for the tips everyone.
I will definitely take up your suggestions. I like the idea of doing an include file wherever possible.
|Commenting your changes helps, |
With wordpress, it doesn't help at all, they often get overwritten. They need to be documented and saved in a separate file and in a place with a file name one would recognized after an update. Never again. :-\
Your best bet is to download all of your current WordPress files before an update. Then using a tool like freefilesync:
Compare which files have changed. Then use a tool like WinMerge or KDiff to compare the differences per file.
If anyone didn't notice, when they updated to 3.3.2 and posted which files had changed, they missed one on their list of files revised (not including the default theme language updates). [codex.wordpress.org...]
I believed they missed this one:
In that file they moved this:
$userdata = $user;
But here are the files that were modified for 3.3.2:
List of Files Revised in WordPress 3.3.2 vs. WordPress 3.3.1
Thanks so much for the detailed explanation.
I think that I might have actually just changed the theme files and NOT the core files after all... but I am not certain.
so your explanation will help me double check.
Thanks again everyone for the input.
In that case W.P. updates won't affect your files at all **unless** your theme relies on some internal W.P. function that changes. Even then you'd only modify the theme files.