Fixed: WordPress wp-json 500 Server Error
Fix HTTP 500 Server errors for /wp-json/ or WP API requests on Wordpress on any shared hosting or cloud hosting.
In adherence to our rigorous editorial policy, this article's content has undergone careful testing for accuracy and trustworthiness and hence, this content is marked source of information. View editorial history of this content.
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.
Digital Setups has enforced a strict sourcing policy. Every content piece published on our website is passed through strict editorial review for contextual correctness, communication ethics, and programmatic tests wherever required. Our team research solutions from only credible, authentic, and trustworthy sources. Learn more about our editorial process.
Based on our editorial policy, we update our content time to time to ensure its usefulness, reliability, and validity.
Our standardized editorial process ensures right, timely, and usefulness updates to our content. Your honest opinion drives significant improvement to our content. We appreciate you are taking time to share that.
Readers who read this also found these helpful:
- WP: Get Custom Logo Image URL for Built-in or Custom Sizes
- Stripe Alternatives in Pakistan – 2022 Update
- Search Console: Fix “LCP issue: longer than 2.5s (mobile)” Issue
- Woo Express – How it works, Features, & Pricing
- Create XML Sitemap in WordPress without Plugin
- Block Editor: Pattern vs. Variation vs. Style vs. Transformation
- wp_list_users_args Hook – Explanation & Usage Example
- Most Complete WordPress Ping Services List
- What you need to know before starting any online business
- Fixed Error: WordPress XML Declaration Allowed Only Start of Document