2

I get 500 error on wp-json.

if I try to echo get_rest_url() I get example.com/wp-json, which then gives me error 500. I added RewriteCond %{REQUEST_URI} !^/wp-json to my .htaccess, which gave me 404 error instead.

I use postname as settings for permalinks. I've tried http://example.com/?rest_route=/wp-json/v2/posts as well, and it gives me error 500.

EDIT: Okay, I turned on wp_debug. Now I get the error: Fatal error: Call to undefined function register_rest_route() in /customers/0/2/1/. So this is my new error. Any clue for this?

  • 1
    If you get a 500 error, you should be able to check the server's error log for the details of the error. – MrWhite Apr 17 '18 at 11:56
  • 1
    Sweet, thanks. I got the error: Call to undefined function register_rest_route(). Any clue what that is? – Sebastian Berglönn Apr 17 '18 at 12:09
0

Create a .htaccess file with

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.