Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Twice now I've updated wordpress, only to realise that (facepalm) it overwrites some changes I've made to the custom template - to sidebar or something similar.

Obviously I don't HAVE to update, but it's better to for add-ons etc, and I like having the latest products and bug fixes.

What are other people's strategies for straightforward updates to wordpress without losing custom modifications to the default template?

share|improve this question

5 Answers 5

up vote 15 down vote accepted

Very simple : if you use the default template, rename it folder name and css file declaration) and it won't be updated.

If you want the updates (for instance the Twenty One is often updated), create a child theme.

Infos here : http://codex.wordpress.org/Child_Themes

share|improve this answer
1  
+1 for using a child theme. –  tnorthcutt Aug 12 '10 at 16:57
    
I wonder why this plain answer hasn't been accepted already :D –  hakre Aug 20 '10 at 10:12
    
Great! Please update your answer and put the the child theme part bolded and at the start of the answer... just to make it clear that this is the way to do customizations. –  sorin Sep 20 '10 at 10:34

First: You should never make changes to the WordPress core files, instead, write a plugin to do it for you.

Second: If you have only minor to moderate theme customizations, you can use a child theme, thus leaving the core files alone. Alternatively, rename the theme folder so that your changes aren't wiped out by the update.

share|improve this answer
1  
Doing a hack on the core files is faster to write a plugin if you are not used to. The important thing is remember that you have done it. –  Drake Aug 12 '10 at 16:17
3  
@Drake: apply_filters() and do_action() literally take somewhere in the neighborhood of 0.0000001 seconds last I looked. There is no good reason to modify a core file. –  Viper007Bond Aug 12 '10 at 19:40
    
@Drake: Agree with Viper007Bond; DO NOT MODIFY CORE FILE. PERIOD. If you want an excuse to modify core you can always find a way to rationalize it, but it is never a good idea. –  MikeSchinkel Aug 14 '10 at 4:13
    
@AlexakaViper007Bond, Drake was taking into account learning how to write plugins and looking up the hooking mechanisms and finding out how to do one for the specific task at hand. So no, it’s not 0.0000001 seconds, it can take hours of reading and searching, whereas changing a line of PHP can take a few seconds. –  Synetech Nov 17 '12 at 19:14

I do not use the Dashboard updater.

I install WordPress using Subversion; all my local modifications can be shown with svn diff and in most cases they are seamlessly merged with the new codebase when I switch to a new release number. The core and many plugins and themes are available through SVN. Not all unfortunately, but that still leaves you with an out: create a repository so that you never lose changes even if you use the automatic updater on a plugin. Obviously some strong VCS skills help here. :)

http://codex.wordpress.org/Installing/Updating_WordPress_with_Subversion

share|improve this answer

Keep your copy of your modified code-base in a source control system. I recommend mercurial.

Drop the original version of the wordpress code that you went on to modify into mercurial and commit it. Then drop your modified codebase over the top of it and commit it while giving it a branch name. Call the branch 'oursite', whatever.

The point is, mercurial now knows how your site differs from the standard distribution. This makes upgrades easier.

When the next version of wordpress comes out, download it and drop it over the top of your local mercurial working directory. Just make sure you 'update' that working copy to the default branch, ie not your 'oursite' branch. Mercurial now knows how the new wordpress version differs from the previous one. Mercurial is very good at merging the differences from two 'child' versions of a common 'parent' and more often than not, your custom tweaks will be incorporated fine.

share|improve this answer

Even my custom theme gets updates every now and then. I download it locally first and do a compare using BeyondCompare to see where the changes are, and if I can safely skip the files where my custom changes were made. If not, I manually update the source files before uploading it to my site. This is a bit of extra work, but required if you've made custom changes to your theme/site.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.