{"id":2529,"date":"2024-05-09T11:15:29","date_gmt":"2024-05-09T09:15:29","guid":{"rendered":"https:\/\/www.molongui.com\/help\/?p=2529"},"modified":"2024-05-09T11:25:53","modified_gmt":"2024-05-09T09:25:53","slug":"using-the-custom-php-setting","status":"publish","type":"post","link":"https:\/\/www.molongui.com\/help\/using-the-custom-php-setting\/","title":{"rendered":"Using the Custom PHP Setting"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"2529\" class=\"elementor elementor-2529\" data-elementor-post-type=\"post\">\n\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-7291164 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"7291164\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-fd53057\" data-id=\"fd53057\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-6f5df8f elementor-widget elementor-widget-text-editor\" data-id=\"6f5df8f\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>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&#8217;s behavior to better suit your website&#8217;s needs.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-0ad01af elementor-widget elementor-widget-heading\" data-id=\"0ad01af\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Important: No Automatic Error Checking<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-2f24cb4 elementor-widget elementor-widget-text-editor\" data-id=\"2f24cb4\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p><strong>Please note:<\/strong> When you add your custom PHP code through the plugin settings, <strong>no automatic error checking<\/strong> 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.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-997d729 elementor-widget elementor-widget-heading\" data-id=\"997d729\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Default Behavior<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-6bae238 elementor-widget elementor-widget-text-editor\" data-id=\"6bae238\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>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&#8217;s backend.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-7bd3e9a elementor-widget elementor-widget-heading\" data-id=\"7bd3e9a\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Enabling Custom PHP in the Admin Area<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-fd3a3f5 elementor-widget elementor-widget-text-editor\" data-id=\"fd3a3f5\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>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 <strong>&#8220;Enable custom PHP in admin&#8221;<\/strong>. This allows the custom PHP to execute across the entire site, including the backend.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-02f7568 elementor-widget elementor-widget-heading\" data-id=\"02f7568\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h3 class=\"elementor-heading-title elementor-size-default\">Caution When Enabling Backend Execution<\/h3>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-d0eecfc elementor-widget elementor-widget-text-editor\" data-id=\"d0eecfc\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Before enabling backend execution of your custom PHP code, please consider the following precautions:<\/p><ol><li><strong>Test Your Code:<\/strong> 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.<\/li><li><strong>Recovery Options:<\/strong> 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 &#8220;Boilerplate&#8221; in the examples below is a placeholder and should be replaced with the actual plugin ID. For instance, for the Molongui Authorship plugin, use <code>?nophpAuthorship<\/code> and <code>?phpAuthorship<\/code>. The exact query argument for each plugin can be found on the plugin settings page, under the help tip for the &#8220;<strong>Enable custom PHP in admin<\/strong>&#8221; setting.<\/li><\/ol>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-ea4813c elementor-widget elementor-widget-code-highlight\" data-id=\"ea4813c\" data-element_type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"prismjs-default copy-to-clipboard \">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-php \">\n\t\t\t\t<code readonly=\"true\" class=\"language-php\">\n\t\t\t\t\t<xmp>https:\/\/yourwebsite.com\/wp-admin\/options-general.php?page=molongui-boilerplate&tab=advanced&nophpBoilerplate<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-8f16c50 elementor-widget elementor-widget-text-editor\" data-id=\"8f16c50\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>This parameter will temporarily disable the custom PHP, allowing you to regain access to the admin area and correct the issue.<\/p><ol start=\"3\"><li><strong>Enable Gradually:<\/strong> If you are unsure about the code&#8217;s behavior in the admin area, enable it temporarily by appending the appropriate query argument to your wp-admin URL to test its effects:<\/li><\/ol>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-76ddb02 elementor-widget elementor-widget-code-highlight\" data-id=\"76ddb02\" data-element_type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"prismjs-default copy-to-clipboard \">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-php \">\n\t\t\t\t<code readonly=\"true\" class=\"language-php\">\n\t\t\t\t\t<xmp>https:\/\/yourwebsite.com\/wp-admin\/options-general.php?page=molongui-boilerplate&tab=advanced&phpBoilerplate<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-eb8d1df elementor-widget elementor-widget-heading\" data-id=\"eb8d1df\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Best Practices for Using Custom PHP<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-72b3852 elementor-widget elementor-widget-text-editor\" data-id=\"72b3852\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<ul><li><strong>Keep Backups:<\/strong> Always maintain regular backups of your WordPress site, especially before implementing custom PHP code.<\/li><li><strong>Seek Expert Advice:<\/strong> If you are not confident in your PHP coding skills, consider consulting with a professional developer to review your code.<\/li><li><strong>Stay Informed:<\/strong> Regularly update yourself with PHP best practices and WordPress coding standards to ensure your custom code is efficient, secure, and compatible.<\/li><\/ul>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-c7f20ad elementor-widget elementor-widget-heading\" data-id=\"c7f20ad\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Summary<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-d8ec80c elementor-widget elementor-widget-text-editor\" data-id=\"d8ec80c\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Custom PHP can significantly enhance your site&#8217;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.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>This support article will guide users on safely implementing PHP snippets to modify default plugin behavior, warn them about the importance of error-free code, and explain how to enable execution in the backend if needed.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[8,12,29,13],"class_list":["post-2529","post","type-post","status-publish","format-standard","hentry","category-doc","tag-common","tag-howto","tag-settings","tag-troubleshooting"],"_links":{"self":[{"href":"https:\/\/www.molongui.com\/help\/wp-json\/wp\/v2\/posts\/2529","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.molongui.com\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.molongui.com\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.molongui.com\/help\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.molongui.com\/help\/wp-json\/wp\/v2\/comments?post=2529"}],"version-history":[{"count":7,"href":"https:\/\/www.molongui.com\/help\/wp-json\/wp\/v2\/posts\/2529\/revisions"}],"predecessor-version":[{"id":2536,"href":"https:\/\/www.molongui.com\/help\/wp-json\/wp\/v2\/posts\/2529\/revisions\/2536"}],"wp:attachment":[{"href":"https:\/\/www.molongui.com\/help\/wp-json\/wp\/v2\/media?parent=2529"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.molongui.com\/help\/wp-json\/wp\/v2\/categories?post=2529"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.molongui.com\/help\/wp-json\/wp\/v2\/tags?post=2529"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}