Support » Fixing WordPress » Site health: Rest API did not behave correctly

  • Resolved Paddy Landau


    I look after 9 WordPress sites. They’re all simple, on the same hosting account, on the same server, and use the same versions of PHP, MySQL, etc.

    For 8 of the sites, the Site Health page (/wp-admin/site-health.php) shows zero errors.

    The remaining site is currently basically a stub awaiting development. Its site health shows one error, “The REST API did not behave correctly,” with the further explanation, “The REST API did not process the context query parameter correctly.”

    To try to diagnose this, I disabled all plugins (just two of them are installed), and activated the default theme Twenty Twenty One. There are only two other themes installed, one a child of the other.

    The error persists.

    I’ve been searching for ages to find a solution to this REST API error, but nothing seems to give an answer.

    What can you suggest, please?

    More information:

    • WordPress 5.6
    • PHP version 7.4.11
    • MySQL version 5.6.49
    • Shared hosting with GoDaddy

    Thank you

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi!
    Do you have some problems with The Block Editor or something else?
    Try to open a console while editing some post and see what answer will get the request after the attempt to save the post.

    And also enable debugging log to see if errors will be reported there:

    Debugging in WordPress

    Thread Starter Paddy Landau


    Thank you for your reply, Olga.

    I am able to edit and save a Page in the block error without any problem whatsoever. In the console, one error was reported as in the screenshot below.

    I enabled debugging with these two commands in wp-config.php:

    define( 'WP_DEBUG', true );
    define( 'WP_DEBUG_LOG', true );

    However, the file wp-content/debug.log was not created when I edited, updated and viewed a Page.

    I’m flummoxed.

    If everything else is working fine, you can just drop it, possibly it’s something with Site Health itself or cookies, or… ¯\_(ツ)_/¯

    Because your site in the development, you can play with ‘get_test_rest_availability’
    in ‘wp-admin/includes/class-wp-site-health.php:1908’
    function and make it print some value or result in the process.

    Don’t forget to return it back into the original state, if you will decide to modify it.

    Thread Starter Paddy Landau


    Thank you again for your response, Olga.

    I looked at wp-admin/includes/class-wp-site-health.php, and tried going to the website at .../wp-admin/includes/class-wp-site-health.php:1908, but it gave a 404 Not Found response.

    I don’t know what get_test_rest_availability means. I looked it up but didn’t understand what I found.

    Ok, sorry, possibly I just confused you. If everything is working, let’s just drop it and if your site will have some issues will look at them then )

    Thread Starter Paddy Landau


    Thank you, Olga.

    As it’s a new installation, I might just reinstall from scratch.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Site health: Rest API did not behave correctly’ is closed to new replies.