Title: Modifying Core Files?
Last modified: August 21, 2016

---

# Modifying Core Files?

 *  Resolved Anonymous User 12867351
 * (@anonymized-12867351)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/modifying-core-files-1/)
 * I would like to make a few small changes to the way some parts of WordPress work
   on my site.
    This ultimately means adding 1 or 2 lines of code to certain files
   in the wp-includes folder.
 * The problem that I have is that they’ll most likely be overwritten when I update
   WordPress.
    So, **I’d like to know if there’s a way of making child templates
   for core files like there is for themes**? Or if my only option is to backup 
   my custom files before updating and restore them afterwards?

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/modifying-core-files-1/#post-4045453)
 * No, but there are lots of actions and filters you can hook into to alter how 
   WP works. I’ve done hundreds of hacks and it’s very rare to find a situation 
   that can only be fixed by altering core files.
 * Restoring customized files is a very poor choice as other content on that file
   besides your changes may not work properly with updated files or may contain 
   security weaknesses that were patched with the update.
 * Altering core files means you’re destined to modifying updated files manually
   line by line. Better to use that time to find a “clean” hack that does not require
   changing core files. There’s almost always a way.
 *  Thread Starter Anonymous User 12867351
 * (@anonymized-12867351)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/modifying-core-files-1/#post-4045465)
 * I have a very specific idea that can be achieved with just 2 lines of code.
    
   Unfortunately, it seems that no-one else has had the same idea and thus, there
   are no plugins that can achieve the level of control I’m after.
 * So basically, I need to know if there is an easy way to have WordPress process
   my code for the relevant feature instead of it’s own. – like how child themes
   work.
 * The current plan is to just add the relevant code where it needs to be after 
   each update.
    It’s quite easy at just a single copy-paste, but I’d like a way
   to achieve this that wouldn’t require the extra step in the update process.
 * I don’t exactly want to write a whole plugin with plenty of code to replace an
   entire WordPress module, which I will then have to keep up-to-date and worry 
   about compatibility. Nor do I know how to do this and I’m lazy to learn. (since
   I’m short on time)
 * I just need to know if there is a way to have WordPress reference my PHP file
   for a single function instead of it’s own, without modifying it’s own one.
 *  [catacaustic](https://wordpress.org/support/users/catacaustic/)
 * (@catacaustic)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/modifying-core-files-1/#post-4045466)
 * As bcworkz said, **filters** and **actions**. You will need to look through the
   source code (which I’m sure you’ve done so far) and see what filters or actions
   are available to modify the functionality that you’re looking for. If they are
   there in the code, use them. If they are not there, you would be stuck with either
   not being able to make the changes, or hacking the core and loosing the changes
   on every update.
 * Another note too, if you can’t find an action or filter that will work the way
   that you want it to you can always propose a change to the core code to add one
   in. Think of that as a way of givng back to the community. 🙂
 *  Thread Starter Anonymous User 12867351
 * (@anonymized-12867351)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/modifying-core-files-1/#post-4045487)
 * Thanks.
    You explained it a bit better.
 * After looking through
    [http://codex.wordpress.org/Plugin_API/Filter_Reference](http://codex.wordpress.org/Plugin_API/Filter_Reference)
   and [http://codex.wordpress.org/Function_Reference/add_filter](http://codex.wordpress.org/Function_Reference/add_filter)
 * I think I may me able to achieve my goal.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Modifying Core Files?’ is closed to new replies.

## Tags

 * [child](https://wordpress.org/support/topic-tag/child/)
 * [modifying](https://wordpress.org/support/topic-tag/modifying/)
 * [Themes](https://wordpress.org/support/topic-tag/themes/)
 * [wp-includes](https://wordpress.org/support/topic-tag/wp-includes/)

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 4 replies
 * 3 participants
 * Last reply from: Anonymous User 12867351
 * Last activity: [12 years, 9 months ago](https://wordpress.org/support/topic/modifying-core-files-1/#post-4045487)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
