dougua9165 2017-10-16 17:09
浏览 30
已采纳

如何在REST API输出中禁用错误​​消息

Recently I have upgraded WordPress theme and plugins of my website to enable REST API. My site has more the 30 thousand custom post types currently with few meta information. When I try to access https://example.com/wp-json/wp/v2/book It gives me a fatal error about allowed memory size which has full file name with the full path of my hosting server.

I want to disable the error message or replace the error message with something else so that file path does not display. How to do it?

FYI, I have used the following constant in the wp-config.php file to solve this issue but no luck.

define('WP_DEBUG', false);
define('WP_MEMORY_LIMIT', '256M');

Shows the error with file path in hosting server while request REST API

  • 写回答

1条回答 默认 最新

  • douwa6220 2017-10-16 18:17
    关注

    Found a solution at wpmudev to hide the error message displaying in the REST API output:

    After the line define('WP_DEBUG', true); add the line:

    @ini_set('display_errors', 1);
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥70 类鸟群Boids——仿真鸟群避障的相关问题
  • ¥15 CFEDEM自带算例错误,如何解决?
  • ¥15 有没有会使用flac3d软件的家人
  • ¥20 360摄像头无法解绑使用,请教解绑当前账号绑定问题,
  • ¥15 docker实践项目
  • ¥15 数电几道习题,写出作答过程,ai一律不采用
  • ¥15 利用pthon计算薄膜结构的光导纳
  • ¥15 海康hlss视频流怎么播放
  • ¥15 Paddleocr:out of memory error on GPU
  • ¥30 51单片机C语言数码管驱动单片机为AT89C52