Using the Custom PHP Setting

Molongui » Help » » Using the Custom PHP Setting

The Custom PHP setting in Molongui plugins allows administrators to add custom PHP snippets to modify and enhance the default functionality of the plugin. This powerful feature gives you the flexibility to tailor the plugin’s behavior to better suit your website’s needs.

Important: No Automatic Error Checking

Please note: When you add your custom PHP code through the plugin settings, no automatic error checking is performed. It is crucial that you ensure your code is free from errors before saving it to prevent issues such as fatal errors that could affect the accessibility of your site.

Default Behavior

By default, any custom PHP code entered in the plugin settings is executed only on the frontend of your site. This ensures that the WordPress admin area remains unaffected by any modifications, safeguarding access to your site’s backend.

Enabling Custom PHP in the Admin Area

If you need the custom PHP code to run in the backend (wp-admin) as well, you can activate this capability by enabling the setting labeled “Enable custom PHP in admin”. This allows the custom PHP to execute across the entire site, including the backend.

Caution When Enabling Backend Execution

Before enabling backend execution of your custom PHP code, please consider the following precautions:

  1. Test Your Code: Ensure that your PHP snippet works as expected on the frontend. If possible, test the code in a staging environment before applying it to the live site.
  2. Recovery Options: If a piece of custom PHP code causes a fatal error and prevents access to your dashboard, you can disable the custom PHP by appending a specific query argument to your wp-admin URL. Note that “Boilerplate” in the examples below is a placeholder and should be replaced with the actual plugin ID. For instance, for the Molongui Authorship plugin, use ?nophpAuthorship and ?phpAuthorship. The exact query argument for each plugin can be found on the plugin settings page, under the help tip for the “Enable custom PHP in admin” setting.


This parameter will temporarily disable the custom PHP, allowing you to regain access to the admin area and correct the issue.

  1. Enable Gradually: If you are unsure about the code’s behavior in the admin area, enable it temporarily by appending the appropriate query argument to your wp-admin URL to test its effects:


Best Practices for Using Custom PHP

  • Keep Backups: Always maintain regular backups of your WordPress site, especially before implementing custom PHP code.
  • Seek Expert Advice: If you are not confident in your PHP coding skills, consider consulting with a professional developer to review your code.
  • Stay Informed: Regularly update yourself with PHP best practices and WordPress coding standards to ensure your custom code is efficient, secure, and compatible.


Custom PHP can significantly enhance your site’s functionality but comes with responsibilities. Careful testing, cautious deployment, and having recovery strategies are essential steps to safely using the Custom PHP setting in Molongui plugins.

Updated on May 9, 2024

Did not find a solution? We are here to help you succeed.
Open a support ticket