Software⏱️ 3 min read📅 2026-06-04

How to Fix: Wordpress REST API (wp-api) 404 Error: Cannot access the WordPress REST API

Enable WP-API in WordPress settings and ensure correct URL structure.

Quick Answer: Check if WP-API is enabled in WordPress settings, and verify that the API URL matches the site's root URL.

The WordPress REST API (WP-API) 404 error can be frustrating, especially when migrating from local development to a production environment. This issue affects users who rely on the WP-API for their WordPress site's functionality.

Enabling pretty permalinks is not directly related to the WP-API 404 error, but it's essential to ensure that the URL structure is consistent with the API endpoint.

⚠️ Common Causes

  • The primary cause of the WP-API 404 error is often due to a misconfiguration or incorrect setup of the WordPress REST API. This can be caused by changes in the site URL, permalink settings, or plugin configurations.
  • Another alternative reason for this error is an issue with the EC2 instance's configuration or security settings, which may block access to the WP-API endpoint.

🚀 How to Resolve This Issue

Updating WordPress Permalink Settings

  1. Step 1: 1. Log in to your WordPress dashboard and navigate to Settings > Permalinks.
  2. Step 2: 2. Select the 'Post name' or 'Pretty permalinks' option, depending on your chosen structure (e.g., http://.../wordpress/sample-post/).
  3. Step 3: 3. Click 'Save Changes' to update the permalink settings.

Checking EC2 Instance Configuration and Security Settings

  1. Step 1: 1. Verify that your EC2 instance's security group rules allow incoming requests to the WP-API endpoint (http://.../wordpress/wp-json/).
  2. Step 2: 2. Ensure that the WP-API plugin is properly configured and enabled on your WordPress site.
  3. Step 3: 3. Check for any firewall or security software configurations that may be blocking access to the WP-API endpoint.

💡 Conclusion

By following these steps, you should be able to resolve the WP-API 404 error and access your WordPress REST API endpoints successfully. Remember to test your site thoroughly after making changes to ensure that everything is working as expected.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions