- How to Enable Adding Custom PHP to the WooCommerce Store through a Plugin?
- How to Add Custom PHP Code to your WordPress or WooCommerce Site?
- Store Preview: Frontend of a WooCommerce Store with the Custom PHP Code Executed
- Reset Settings
- How to Make Your Site Functional After It is Not Loading Due to Invalid Custom PHP?
The Custom PHP Plugin lets store owners add custom PHP code to their website without editing the “functions.php” file or frequently using the FTP client. The plugin will add a PHP file in your uploads folder automatically and execute it from there only.
On editing the code through the custom PHP plugin’s settings, this file will be updated.
With this plugin installed on your store, you will not be updating your core PHP files of the theme, including “functions.php,” when your WordPress is updated. Your custom PHP code will remain intact during updates.
Note: Be extra cautious while adding Custom PHP to your website. One slight mistake and your website will either be unavailable or load with errors.
How to Enable Adding Custom PHP to the WooCommerce Store through a Plugin? #
Note: Download, install, and activate the Booster for WooCommerce Plugin before you follow these steps. Booster is the parent plugin for the Custom PHP Plugin, and therefore, it is essential to activate it first.
- Login to your WordPress administrator dashboard
- Go to the Booster > Plugins > EMAIL & MISC..
- Select Enable for the Custom PHP plugin and save changes.
How to Add Custom PHP Code to your WordPress or WooCommerce Site? #
You can use Booster’s Custom PHP Code Plugin to add custom PHP code to your WordPress or WooCommerce website. For this, enable the plugin and insert the code in the Options > Custom PHP input field.
Be Careful because incorrect or flawed code will result in your site’s downtime.
Note: Do not use the “<?php” or “?>” tag in this field. Add the code directly.
Here is an example:
Store Preview: Frontend of a WooCommerce Store with the Custom PHP Code Executed #
Input: echo (“Hello, buyers”);
Reset Settings #
Click on the Reset Settings button to clear the custom PHP code and disable the plugin at once. Basically, the function of this button is to restore the plugin’s default settings.
You may also disable the Custom PHP plugin instead of clearing your code in order to prevent it from affecting your website so that you can edit the code and use it later on.
How to Make Your Site Functional After It is Not Loading Due to Invalid Custom PHP? #
If you have enabled Custom PHP for your website, and because the code is erroneous, your site has become unavailable, do not panic.
To fix the problem, you need to add the following attribute to your website’s URL:
Make sure that you are using admin or shop manager credentials to log in while trying this. Also, to avoid trouble for you, the Custom PHP Plugin does not execute the custom PHP code on the wp-login.php page.
Let us give you a few examples to view your admin portal with the help of this solution:
This URL will take you to the Booster > Plugins > EMAIL & MISC. > Custom PHP plugin settings page:
Similarly, see these 2 examples to view your shop’s frontend when the URL has no attribute already vs. when it has attribute(s) already: