如何调试未在 WordPress 中完全呈现的页面? [英] How to debug a page not fully rendered in WordPress?
问题描述
我被要求查看门户以解决论坛问题并运行更新脚本.我同意,因为我有 DNN 和 Drupal 的经验.我已经做到了 - 没有问题.我想.
I was asked to look into a portal to fix an issue with forum and run update scripts. I agreed, having experience with DNN and Drupal. I have done it - no issues there. I thought.
有人告诉我页脚消失了,而用户是对的.当我运行一个页面时 - 它突然结束.没有 </body>
标签,没有页面结束脚本;但也没有错误消息.
I was told that the footer disappeared, and a user was right. When I run a page - it ends abruptly. No </body>
tag, no end of page scripts; but also no error messages.
问题是 - 我如何调试它?wp-admin 有登录吗?或调试工具栏?
Question is - how do I debug it? Is there a log in wp-admin? or debug toolbar?
推荐答案
检查你的 footer.php 是否在文件末尾有函数调用 wp_footer();
,就在 <代码></body>.
Check to see if your footer.php has the function call wp_footer();
at the end of the file, right before </body>
.
要在 WordPress 中进行调试,您必须编辑 wp-config.php 文件.
To debug in WordPress, you will have to edit your wp-config.php file.
在 wp-config.php 中查找行 define('WP_DEBUG', false);
并将其设置为 true 例如,define('WP_DEBUG', true);//or false = on or off
.
In wp-config.php look for the line define('WP_DEBUG', false);
and set this to true e.g., define('WP_DEBUG', true); // or false = on or off
.
现在在我们刚刚编辑的行下面添加以下几行.
Now add the following lines underneath the line we just edited.
<代码>如果(WP_DEBUG){
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);//true 显示在站点上 false 隐藏但仍写入 debug.log
@ini_set('display_errors', 0);//wp-content/debug.log
}
所以完整的代码应该如下所示:<代码>
定义('WP_DEBUG',真);//或错误
So the complete code should look like the following:
define('WP_DEBUG', true); // or false
if(WP_DEBUG){
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);//true 显示在站点上 false 隐藏但仍写入 debug.log
@ini_set('display_errors', 0);//wp-content/debug.log
}
if(WP_DEBUG){
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false); // true to display on site false to hide but still writes to debug.log
@ini_set('display_errors', 0); // wp-content/debug.log
}
这将打开 WordPress 中的调试,它不会在屏幕上显示错误,但会将它们写入位于 /wp-content/的名为 debug.log 的文件中debug.log 您可以返回并打开它以调试您的问题.
What this will do is turn on debugging in WordPress, it will not show errors on screen but it will write them to a file named debug.log located in /wp-content/debug.log where you can go back and open it up to debug your problems.
祝你好运.
这篇关于如何调试未在 WordPress 中完全呈现的页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!