{"id":2061,"date":"2026-07-05T00:13:44","date_gmt":"2026-07-04T16:13:44","guid":{"rendered":"https:\/\/virtualcardx.com\/2026\/07\/05\/wordpress-debug-mode\/"},"modified":"2026-07-05T01:42:26","modified_gmt":"2026-07-04T17:42:26","slug":"wordpress-debug-mode","status":"publish","type":"post","link":"https:\/\/virtualcardx.com\/en\/2026\/07\/05\/wordpress-debug-mode\/","title":{"rendered":"How to Enable Debug Mode on a WordPress Site to Troubleshoot Errors"},"content":{"rendered":"<h2>How to Enable Debug Mode on a WordPress Site to Troubleshoot Errors<\/h2>\n<p>Last week, I helped a friend who runs an independent e-commerce site for international trade troubleshoot a problem with his website. After he installed a new credit card payment plugin, the front end went completely blank, and he couldn\u2019t even access the WordPress admin dashboard. When many beginners encounter this \u201cWordPress blank screen\u201d or \u201cHTTP 500 Internal Server Error,\u201d their first instinct is to delete the database and reinstall everything\u2014but that\u2019s actually completely unnecessary. For issues caused by code conflicts or plugin incompatibilities, simply enabling WordPress\u2019s built-in debug mode usually allows you to pinpoint exactly which file and line of code is causing the problem within three minutes. Today, drawing on my experience with daily operations and development of e-commerce sites, I\u2019ll walk you through the practical steps.<\/p>\n<h3>Step 1: Locate the wp-config.php file in the website's root directory<\/h3>\n<p>Whether you're using SiteGround, BlueHost, or a VPS deployed on AWS or Alibaba Cloud, the core configuration files for all WordPress sites are <code>wp-config.php<\/code>. I usually use the Baota Panel, but if you're using a shared hosting plan, you can connect to the server using an FTP client (such as FileZilla).<\/p>\n<p>Go to the website's root directory (usually <code>public_html<\/code> Or <code>wwwroot<\/code>), find <code>wp-config.php<\/code> File: Right-click to edit directly.<\/p>\n<h3>Step 2: Replace the WP_DEBUG system constant<\/h3>\n<p>Scroll down in the file until you find something like <code>define( 'WP_DEBUG', false );<\/code> This line of code. Many tutorials simply tell you to <code>false<\/code> Change to <code>true<\/code>...However, when it comes to actually running a B2B e-commerce website, I strongly recommend using the following comprehensive set of troubleshooting strategies:<\/p>\n<ul>\n<li><strong>WP_DEBUG<\/strong>: The master switch to enable debug mode.<\/li>\n<li><strong>WP_DEBUG_LOG<\/strong>: Write all error messages to a log file instead of displaying them on the web page.<\/li>\n<li><strong>WP_DEBUG_DISPLAY<\/strong>: Disable error message display on the front end to prevent customers from seeing garbled text or exposing server paths.<\/li>\n<\/ul>\n<p>You can simply copy the code below and replace the original line with it:<\/p>\n<p><code>define( 'WP_DEBUG', true );<br \/>\ndefine( 'WP_DEBUG_LOG', true );<br \/>\ndefine( 'WP_DEBUG_DISPLAY', false );<\/code><\/p>\n<p>Once you save the file, WordPress's debug engine will start working quietly in the background.<\/p>\n<h3>Why is writing to a log file strongly recommended instead of displaying the information directly?<\/h3>\n<p>This is actually a comparative analysis of safety and efficiency. If we only set <code>define( 'WP_DEBUG', true );<\/code>...the error messages will be displayed directly in the body of the web page. This leads to two critical problems: First, international customers browsing your website will see a bunch of PHP error messages, which severely undermines their trust in your site; second, the error messages will expose your server\u2019s absolute path, leaving an opening for hackers to exploit.<\/p>\n<p>And in conjunction with <code>WP_DEBUG_LOG<\/code> When the feature is enabled, error messages are hidden but silently logged. Based on the hundreds of support tickets I\u2019ve handled, using log analysis can reduce the time needed to identify \u201cplugin conflicts\u201d from an average of 2 hours to less than 10 minutes. This is especially true when dealing with complex logic, such as failed integrations with WooCommerce\u2019s virtual credit card payment gateways, where logs can capture the complete API request flow.<\/p>\n<h3>Step 3: Check the debug.log file to pinpoint the culprit<\/h3>\n<p>Once you've finished modifying the code, refresh the webpage where you previously encountered the error. Next, return to your website's root directory and navigate to <code>wp-content<\/code> Folder. You'll see that there's a new folder inside named <code>debug.log<\/code> the document.<\/p>\n<p>Download and open this file; the most recent error message is usually at the very bottom of the file. For example, in my friend\u2019s case, the last line of the log read:<code>PHP Fatal error: Uncaught Error: Call to undefined function wc_get_order() in \/public_html\/wp-content\/plugins\/stripe-gateway\/includes\/class-wc-gateway-stripe.php on line 45<\/code>The<\/p>\n<p>This passage contains a great deal of information:<\/p>\n<ul>\n<li><code>Fatal error<\/code> This indicates a fatal error that causes a blank screen.<\/li>\n<li><code>plugins\/stripe-gateway\/...<\/code> It was clearly identified that the problem was with the Stripe payment plugin.<\/li>\n<li><code>on line 45<\/code> Let us know that it was specifically line 45 of the code that failed to execute (because, to save time, he called the order function directly without loading the WooCommerce core files).<\/li>\n<\/ul>\n<p>At this point, the solution is clear: either disable the plugin causing the error, or contact the plugin developer to fix that line of code. The problem is easily solved.<\/p>\n<h3>A Few Practical Tips<\/h3>\n<ul>\n<li><strong>Be sure to turn off debug mode after troubleshooting is complete:<\/strong> Once the website goes live and begins serving the public, be sure to <code>WP_DEBUG<\/code> Change back to <code>false<\/code>, otherwise <code>debug.log<\/code> As users access the files, they grow larger and larger, eventually slowing down database reads and server response times, and may even fill up the disk space.<\/li>\n<li><strong>Making the Most of the Query Monitor Plugin:<\/strong> If you want to see a more in-depth performance analysis (such as which SQL queries are slowing down page load times), I recommend installing a free plugin called Query Monitor in the backend. It can be added to the top toolbar in WordPress and displays all API requests, PHP errors, and database query durations directly on the front end\u2014making it a powerful tool for optimizing the speed of e-commerce websites.<\/li>\n<li><strong>Regularly clear out old logs:<\/strong> During the development phase,<code>debug.log<\/code> They can easily exceed several dozen MB. I usually clean up the log files once a week to keep my development environment running smoothly.<\/li>\n<\/ul>\n<p>WordPress itself is a very transparent CMS system. As long as you master the right troubleshooting methods, you\u2019ll be able to handle anything with ease\u2014whether it\u2019s integrating complex cross-border payment gateways or deeply customizing B2B inquiry forms. The next time your website displays an error or a blank screen, don\u2019t panic\u2014start by checking <code>debug.log<\/code> See what it has to tell you.<\/p>","protected":false},"excerpt":{"rendered":"<p>How to Enable Debug Mode on a WordPress Site \u2026 <\/p>\n<p class=\"read-more-container\"><a title=\"How to Enable Debug Mode on a WordPress Site to Troubleshoot Errors\" class=\"read-more button\" href=\"https:\/\/virtualcardx.com\/en\/2026\/07\/05\/wordpress-debug-mode\/#more-2061\" aria-label=\"Read more about \u5982\u4f55\u4e3aWordPress\u7f51\u7ad9\u5f00\u542f\u8c03\u8bd5\u6a21\u5f0f\u6392\u67e5\u9519\u8bef\">Read more<\/a><\/p>","protected":false},"author":1,"featured_media":2224,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[31],"tags":[],"class_list":["post-2061","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-wordpress","resize-featured-image"],"_links":{"self":[{"href":"https:\/\/virtualcardx.com\/en\/wp-json\/wp\/v2\/posts\/2061","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/virtualcardx.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/virtualcardx.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/virtualcardx.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/virtualcardx.com\/en\/wp-json\/wp\/v2\/comments?post=2061"}],"version-history":[{"count":5,"href":"https:\/\/virtualcardx.com\/en\/wp-json\/wp\/v2\/posts\/2061\/revisions"}],"predecessor-version":[{"id":2196,"href":"https:\/\/virtualcardx.com\/en\/wp-json\/wp\/v2\/posts\/2061\/revisions\/2196"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/virtualcardx.com\/en\/wp-json\/wp\/v2\/media\/2224"}],"wp:attachment":[{"href":"https:\/\/virtualcardx.com\/en\/wp-json\/wp\/v2\/media?parent=2061"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/virtualcardx.com\/en\/wp-json\/wp\/v2\/categories?post=2061"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/virtualcardx.com\/en\/wp-json\/wp\/v2\/tags?post=2061"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}