posfan12
posfan12

Reputation: 2651

Best place to store custom functions?

I need to rewrite some functions. For instance, some of the functions here:

https://core.trac.wordpress.org/browser/tags/4.1/src/wp-includes/category-template.php

Should I go ahead and just add them to the end of the same file, or is there a special place that I am supposed to use?

[edit]

Forgot to clarify that I don't want to override the existing functions. I want to copy and edit them under a new name.

Upvotes: 0

Views: 45

Answers (1)

Subharanjan
Subharanjan

Reputation: 668

The file you are referring to is a core WP files which resides inside wp-includes directory. Nothing inside this directory or wp-admin directory should be touched/modified. If you modify anything inside the core, during the WP version upgrade, the modified functionalities will be lost.

WordPress provides ways to modify the existing behaviour of the functionalities. Hooks(Actions/Filters) can be used to override/modify the functionality. Try create a new plugin and add your code there inside wp-content/plugins directory OR you can add your code inside functions.php file of the current active theme.

Hooks: http://codex.wordpress.org/Plugin_API/Hooks

Upvotes: 2

Related Questions