There are many ways to customize functionalities (via PHP) on your WordPress/WooCommerce website – and many developers totally underestimate the pros and cons of each different method. So, today I want to remind you what is the ONLY way you should be customizing WordPress from now on.
Before we pick a customization method…
There is no doubt if you’re about to customize a WordPress website, and even more importantly a WooCommerce website, you need a child theme.
Building a child theme can take about 10 minutes – you only need to create 2 files with a few lines of CSS (style.css) and PHP (functions.php).
Here’s a quick and free video lesson for you: “Where to Place WooCommerce Customization?”
PHP Customization Method 1: WP Editor
WordPress contains a built-in editor that allow you to edit theme files directly from your browser. You can access the WP Editor from the WP Dashboard > Administration > Appearance > Editor.
Even if you have a child theme, using the WP Editor for PHP customization is not a good idea. In fact, the changes you make to the functions.php file are instant. You and any visitors to your site will see the changes immediately – including if you forget a simple comma and break the website (Error 500) without the chance to restore the previous version or click on the “Back” button on your browser.
Never, ever, use the WP Editor for PHP customization. If you break the website you will need access to your FTP so that you can correct the issue… so let’s move on to method 2!
PHP Customization Method 2: FTP
FTP is the best way to customize your WordPress/WooCommerce website.
You can open the files in your favorite text editor (I use Notepad++), do the edits there, save a backup and if you break something you can immediately correct / rename / comment out the PHP function.
Whenever you do work on live websites (like I do), always make sure to ask for the WP login/password as well as the FTP credentials. And remind the client you will not start working until you get the FTP details and test they work!
PHP Customization Method 3: “Code Snippets” Plugin
Code Snippets plugin is super handy when you don’t have a child theme (why would you not have a child theme though?) or when you want to test / run just a couple of PHP snippets.
It’s interface is awesome and easy to use, including the enabling/disabling snippets and your website will not go down if you forget a comma… the plugin will simply tell you what the problem is and disable the snippet without giving Error 500.
The problem is that you won’t be able to find the snippets via FTP or File Manager, as the plugin stores them somewhere in the database. If your website goes down for other problems (a plugin conflict for example), it’s super difficult to disable a code snippet from outside of WordPress.