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.

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

报告相同问题?

悬赏问题

  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!