homepage Welcome to WebmasterWorld Guest from 50.17.176.149
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe and Support WebmasterWorld
Home / Forums Index / Code, Content, and Presentation / WordPress
Forum Library, Charter, Moderators: lorax & rogerd

WordPress Forum

    
How To Update WP If I Changed Some Files?
Planet13




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

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.

 

bunltd




msg:4444782
 6:45 pm on Apr 24, 2012 (gmt 0)

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.

rocknbil




msg:4445375
 3:56 pm on Apr 25, 2012 (gmt 0)

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. :-\

bunltd




msg:4445392
 4:07 pm on Apr 25, 2012 (gmt 0)

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.

Planet13




msg:4445527
 6:39 pm on Apr 25, 2012 (gmt 0)

Thanks for the tips everyone.

I will definitely take up your suggestions. I like the idea of doing an include file wherever possible.

rocknbil




msg:4446060
 3:57 pm on Apr 26, 2012 (gmt 0)

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. :-\

MickeyRoush




msg:4446317
 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------------

Planet13




msg:4446648
 7:18 pm on Apr 27, 2012 (gmt 0)

@ 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.

rocknbil




msg:4447535
 3:34 pm on Apr 30, 2012 (gmt 0)

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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / WordPress
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved