Welcome to WebmasterWorld Guest from 54.158.175.78

Forum Moderators: rogerd & travelin cat

Message Too Old, No Replies

How To Update WP If I Changed Some Files?

   
4:51 pm on Apr 24, 2012 (gmt 0)

WebmasterWorld Senior Member planet13 is a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



Hi there, Everyone:

Well, there is a new update to Wordpress and I would like to update, but I did happen to edit a couple of the wordpress .php files.

So is there an EASY way (or at least a BEST way) to update wordpress without killing the files I edited?

Thanks in advance.
6:45 pm on Apr 24, 2012 (gmt 0)

10+ Year Member



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.
3:56 pm on Apr 25, 2012 (gmt 0)

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member



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:

filename.php

around line 348, change this line (or chunk of code)

// whatever the line WAS

to this

// 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. :-\
4:07 pm on Apr 25, 2012 (gmt 0)

10+ Year Member



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.
6:39 pm on Apr 25, 2012 (gmt 0)

WebmasterWorld Senior Member planet13 is a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



Thanks for the tips everyone.

I will definitely take up your suggestions. I like the idea of doing an include file wherever possible.
3:57 pm on Apr 26, 2012 (gmt 0)

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member



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. :-\
1:04 am on Apr 27, 2012 (gmt 0)



Your best bet is to download all of your current WordPress files before an update. Then using a tool like freefilesync:
[sourceforge.net...]

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:
wp-includes/user.php

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

-----------root------------
readme.html
wp-comments-post.php


-----------wp-admin------------
wp-admin/about.php
wp-admin/plugins.php
wp-admin/press-this.php
wp-admin/setup-config.php

-----------wp-admin/includes/------------
wp-admin/includes/update-core.php


-----------wp-content/themes------------
wp-content/theme/twentyeleven/languages/twentyten.pt

wp-content/theme/twentyten/languages/twentyten.pt


-----------wp-includes------------
wp-includes/capabilities.php
wp-includes/formatting.php
wp-includes/kses.php
wp-includes/ms-functions.php
wp-includes/script-loader.php
wp-includes/user.php
wp-includes/version.php
wp-includes/wp-db.php

-----------wp-includes/js/------------
wp-includes/js/swfobject.js

-----------wp-includes/js/plupload/------------
wp-includes/js/plupload/changelog.txt
wp-includes/js/plupload/handlers.dev.js
wp-includes/js/plupload/plupload.flash.js
wp-includes/js/plupload/plupload.flash.swf
wp-includes/js/plupload/plupload.html4.js
wp-includes/js/plupload/plupload.html5.js
wp-includes/js/plupload/plupload.js
wp-includes/js/plupload/plupload.silverlight.js
wp-includes/js/plupload/plupload.silverlight.xap

-----------wp-includes/js/swfupload/------------
wp-includes/js/swfupload/swfupload.swf



-----------END------------
7:18 pm on Apr 27, 2012 (gmt 0)

WebmasterWorld Senior Member planet13 is a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



@ MickeyRoush

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.
3:34 pm on Apr 30, 2012 (gmt 0)

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member



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.