I'm adding custom request handler using add_action and register_rest_root. Sometimes it's hanging and I'm stuck without any output. I would like to use something like

echo "Label";

to debug my code. But echo only outputs to the webpage source, which is not generated for failed request. How can I achieve this? If possible please advice solution which is applicable on the website already exposed to users.

  • If you set the constant WP_DEBUG_LOG on TRUE and the constant WP_DEBUG_DISPLAY on FALSE, Wordpress will write the DEBUG log to an file and not to the screen. Or you can write easly your "echo"-DEBUG to an file (i know is old school :D ). By the way what is "register_request_root"? – user141080 May 29 '18 at 12:32
  • Function name fixed. – VladimirLenin May 31 '18 at 11:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.