duangao7133 2013-09-10 19:54
浏览 52
已采纳

从wordpress函数获得结果SQL

I'm trying to do some inserting of posts but MySQL keeps dying. Solution is to actually run the insert/update queries manually through SQL than use wordpress. With this in mind, to save me rewriting huge chunks of logic, is there any way to dump the resulting SQL from the wp_insert_posts and other functions without actually running them?

I've tried the query save but it doesn't seem to save the insert queries. Ideally to a file but it'd be nice just to have a debug method to call to see the sql itself.

  • 写回答

1条回答 默认 最新

  • dtpoius74857 2013-09-11 03:58
    关注

    Edit wp-config.php and look for this line:

    define('WP_DEBUG',false);

    Change it to: define('WP_DEBUG',true);

    Then add this line right under it: define('WP_DEBUG_LOG',true);

    Run your offending command/operation and look for ./wp-content/debug.log.

    That should give you more details on what is going wrong including the SQL error and some/all of the SQL command that caused the problem.

    Make sure you turn off (set to false) both of those defines, ESPECIALLY if you do this on a live site.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 模型在y分布之外的数据上预测能力不好如何解决
  • ¥15 processing提取音乐节奏
  • ¥15 gg加速器加速游戏时,提示不是x86架构
  • ¥15 python按要求编写程序
  • ¥15 Python输入字符串转化为列表排序具体见图,严格按照输入
  • ¥20 XP系统在重新启动后进不去桌面,一直黑屏。
  • ¥15 opencv图像处理,需要四个处理结果图
  • ¥15 无线移动边缘计算系统中的系统模型
  • ¥15 深度学习中的画图问题
  • ¥15 java报错:使用mybatis plus查询一个只返回一条数据的sql,却报错返回了1000多条