The rest api did not process the context query parameter correctly – fix

The rest api did not process the context query parameter correctly

After a fresh installation of the wordpress installation, while changing from default plain permalink structure, I couldn’t edit or write any post. This was only possible after installing the classic WordPress editor. The reason for this was an error in the API configuration. I found a solution on the Internet by adding the following rule to the webserver configuration:

location ~ ^/blog/wp-json/ {
   rewrite ^/blog/wp-json/(.*?)$ /blog/?rest_route=/$1 last;

ā€¦ however, this rule didn’t work for me as the ‘wp-json’ folder and its contents was missing in the WordPress installation folder.

A much simpler way to eliminate this error was to edit the file ‘wp-includes/rest-api.php’ on line 327:

- return apply_filters( 'rest_url_prefix', 'wp-json' );
+ return apply_filters( 'rest_url_prefix', '?rest_route=' );

After editing this file, you can easily edit or write posts in the current version of the WordPress editor as well as change the permalinks to any structure you want and the warning in the site health status panel should disappear.

worpress health status pass

The only inconvenience is that you have to edit this file after every wordpress update but you can add cronjob for this file – let’s say at 00:00 on every sunday:

0 0 * * 0 /bin/sed -i "s/'rest_url_prefix', 'wp-json'/rest_url_prefix', '?rest_route='/g" /path/to/blog/wp-includes/rest-api.php

41 thoughts on “The rest api did not process the context query parameter correctly – fix

  1. Thank you, I have just been searching for info approximately this topic for ages
    and yours is the greatest I’ve came upon so far.
    But, what concerning the conclusion? Are you positive in regards to the supply?

  2. Howdy would you mind sharing which blog platform you’re working with?
    I’m planning to start my own blog in the near future
    but I’m having a hard time deciding between BlogEngine/Wordpress/B2evolution and Drupal.
    The reason I ask is because your design and style seems different then most blogs and I’m looking for something completely unique.
    P.S Apologies for getting off-topic but I had to ask!

  3. May I simply just say what a comfort to discover someone
    that really knows what they are talking about on the
    net. You definitely understand how to bring a problem to light and make it important.

    A lot more people ought to look at this and understand this side of
    your story. It’s surprising you aren’t more popular because you surely possess
    the gift.

  4. Hey I know this is off topic but I was wondering if you knew of any
    widgets I could add to my blog that automatically tweet my newest
    twitter updates. I’ve been looking for a plug-in like this for
    quite some time and was hoping maybe you would have some experience with
    something like this. Please let me know if you run into anything.
    I truly enjoy reading your blog and I look forward to your
    new updates.

  5. I like the valuable info you provide to your articles.

    I’ll bookmark your weblog and check once more right here regularly.
    I’m reasonably certain I will be told many new stuff proper
    right here! Best of luck for the following!

  6. Pretty nice post. I simply stumbled upon your blog and wanted to mention that I have truly enjoyed
    browsing your weblog posts. In any case I’ll be subscribing on your rss feed and
    I hope you write again soon! adreamoftrains web hosting providers

  7. Hello there, I discovered your website by means of Google whilst searching for a related subject, your web
    site got here up, it seems good. I have bookmarked
    it in my google bookmarks.
    Hi there, simply became aware of your weblog through Google, and located that it’s really informative.

    I’m gonna be careful for brussels. I will appreciate for
    those who continue this in future. Numerous other people will probably be benefited out
    of your writing. Cheers!

  8. Howdy! I know this is somewhat off topic but I was wondering if you knew where I could
    locate a captcha plugin for my comment form? I’m using the same blog platform as yours and I’m having problems finding one?
    Thanks a lot!

  9. Iā€™m not that much of a online reader to be honest but your blogs
    really nice, keep it up! I’ll go ahead and bookmark your site to come back in the future.


  10. Hello to all, for the reason that I am genuinely
    eager of reading this website’s post to be updated daily. It includes
    fastidious information.

  11. hi!,I love your writing so a lot! share we keep in touch more approximately your post
    on AOL? I require a specialist on this area to unravel my problem.
    Maybe that’s you! Looking ahead to peer you.

  12. May I simply say what a comfort to discover
    somebody who genuinely understands what they are discussing online.
    You certainly realize how to bring a problem to light and make it important.
    More and more people should check this out and understand this side of the story.
    I was surprised you aren’t more popular since you surely possess the gift.

  13. Undeniably consider that which you said. Your favorite
    reason appeared to be at the internet the easiest factor to be aware of.
    I say to you, I certainly get annoyed whilst folks consider worries that they
    plainly do not know about. You managed to
    hit the nail upon the top and also outlined
    out the whole thing with no need side-effects , other people can take a signal.
    Will probably be back to get more. Thank you

  14. I was extremely pleased to discover this site.

    I wanted to thank you for your time due to this wonderful read!!

    I definitely savored every little bit of it and I have you bookmarked to check out new things in your web site.

  15. Useful info. Fortunate me I found your web site by accident, and I’m stunned
    why this coincidence did not came about in advance! I bookmarked it.

  16. This design is wicked! You most certainly know how to keep a reader amused.
    Between your wit and your videos, I was almost moved to start my own blog (well, almost…HaHa!) Great job.

    I really enjoyed what you had to say, and more than that, how you presented it.
    Too cool! 34pIoq5 cheap flights

  17. I love your blog.. very nice colors & theme. Did
    you design this website yourself or did you hire someone to do it
    for you? Plz reply as I’m looking to create my own blog and would like to know where u got this from.
    cheers cheap flights 31muvXS

  18. Thank you for another informative site. Where else may just I am getting that type of information written in such an ideal way?
    I have a project that I am just now operating on, and I
    have been on the look out for such info. y2yxvvfw cheap flights

  19. Thank you, I’ve just been searching for information approximately this topic for a long time and yours
    is the greatest I’ve came upon so far. But, what concerning
    the conclusion? Are you positive in regards to the source?
    cheap flights 3aN8IMa

  20. Write more, thats all I have to say. Literally, it seems
    as though you relied on the video to make your point.

    You definitely know what youre talking about, why waste your intelligence
    on just posting videos to your site when you could be giving us something
    informative to read?

  21. Wow, amazing weblog layout! How lengthy have you been running a blog for?
    you make running a blog look easy. The entire glance of your website is magnificent, as neatly as
    the content!

  22. I like the valuable information you provide for your articles.
    I will bookmark your weblog and take a look at again here frequently.

    I’m quite sure I will learn a lot of new stuff proper right here!
    Best of luck for the next!

  23. Can I simply say what a comfort to find somebody that truly understands what they are talking about on the web.

    You actually know how to bring a problem to light and make it important.
    More and more people ought to read this and understand this side of your story.
    I was surprised that you’re not more popular because you
    certainly have the gift.

  24. I’ve been browsing online greater than three hours
    today, but I never found any interesting article like
    yours. It’s lovely worth sufficient for me. Personally, if all site owners
    and bloggers made good content material as you did, the net will likely be
    much more helpful than ever before.

  25. Thanks for another magnificent post. Where else may just
    anybody get that kind of info in such an ideal manner of writing?
    I’ve a presentation subsequent week, and I am on the search for such information.

  26. Someone necessarily assist to make critically articles I might state.
    This is the first time I frequented your web
    page and to this point? I amazed with the analysis you
    made to create this actual post incredible. Great task!

  27. I am really impressed together with your writing abilities as neatly as
    with the structure in your weblog. Is that this a paid theme or did you modify it yourself?
    Either way keep up the nice quality writing, it’s rare to look a great blog like this one
    these days..

  28. Hey there! This is my first comment here so I just
    wanted to give a quick shout out and tell you I truly enjoy reading your
    articles. Can you recommend any other blogs/websites/forums that deal with the same
    topics? Thanks a lot!

Comments are closed.