Best Practices for Customizing WordPress (PHP)
-
Note: I’ve searched and found an article on best practices, but it didn’t really apply to my particular situation.
I’ve been a developer for years, so I want to know the best way to make changes to the code while also ensuring a fairly smooth upgrade path in the future.
Generally, I try to do the following:- Change the CSS file whenever possible instead of PHP.
- Add arguments to functions used in index.php instead of the individual ‘class’ files, like wp-includes/links.php. For example, the ‘get_links_list’ function has default parameters which I override in index.php instead of changing it in the function declaration or the function body.
- Create a new file for custom PHP functions, which gets included at the beginning of index.php. This way, I can just move all my custom functions to a new version in one file.
- Not create any tables in the database which might collide with the WP prefix
These are all sort of common sense ideas, but can someone let me know if there is a better way to approach customizing wordpress, or if there will be a problem in the future with the above method. Hopefully when there is an upgrade, I can simply replace the directories, like wp-includes, check out the new index.php for new features, and be on my way.
Thank you. And for what it’s worth, WordPress is truly a fantastic piece of software.
(Though it would be even better if there was better security for commenters, but I’ll save that for a different forum)
- The topic ‘Best Practices for Customizing WordPress (PHP)’ is closed to new replies.