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');