Light bulb We updated the website and resources for you. Send Feedback

Fixed: WordPress wp-json 500 Server Error

Published 6 Nov, 2022 Modified 22 Nov, 2022 Read in 1m 6s Viewed 1.343K times

Fix HTTP 500 Server errors for /wp-json/ or WP API requests on Wordpress on any shared hosting or cloud hosting.

Experience Based

Recently on one of our testing WordPress website on Digital Ocean encountered 500 errors in Gutenberg for wp-json API.

Fix # 1: Increase Memory Limit

After troubleshooting, we found that our server memory size was not enough.

By default, the Digital Ocean App Platform build-pack allocates 128 MB of RAM per PHP request. We increased the memory limit to 512MB and the /wp-json/ 500 error was resolved.

To increase WP memory limit, add define( 'WP_MAX_MEMORY_LIMIT', '512M' ); to your WordPress wp-config.php file.

Depending upon your traffic (internal and visitors), running scripts or plugins, and theme complexity, availability of excess RAM, you might want to increase it to 1024MB or more.

If you’ve WP installed on your droplet via Digital Ocean’s marketplace image, you can locate your wp-config.php file at /var/www/html folder. Follow this guide to edit or update WP files on Digital Ocean without SSH client.

Fix # 2: Don’t leave basic post fields blank

Ensure that you’re not leaving basic post fields empty. While reproducing this error, we found another issue in our case. We left the post content field blank and same issue appeared again. We filled the content field, updated or saved the post, and the 500 error was resolved.

The basic post fields includes title and post content.