WordPress Plugin: Custom Functions.php

One of the limitations of adding code to your theme’s function.php file is that these modifications are lost if you change themes, and another is that it is executed after your plugin files are loaded. This means that if you want to modify any behavior in your other plugins that call filtered functions but aren’t hooked to WordPress Actions, you’re out of luck.

I have worked around this on all my sites by creating a custom plugin to handle all of my non-theme specific additions. The only thing this plugin does is ensure that it is loaded first when you activate it, and then pulls in the contents of a functions.php file in the parent plugins directory. The result is that you have custom code running before any of your other plugins. The functions.php file is specifically not included, but it would just but a standard PHP file like the one in your theme.

This file is always up to date based on the trunk of my SVN repository.

custom-functions.php


You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *