WordPress: How to fix the REST API encountered an error with a plugin

WordPress: How to fix the REST API encountered an error with a plugin

The own website works perfectly, the loading speed is great and the visitors are all satisfied. Then you open your WordPress Admin and get the message "The REST API encountered an error". No matter what you try, nothing works. The most common cause is PHP sessions and the wrong integration. Therefore the problem can basically be solved with a simple plugin.

PHP sessions in WordPress

WordPress does not support sessions, but most plugins use the sessions to store small amounts of data at least temporarily. So a session is often used to identify a user. The normal integration using session_start() and the hook init usually works. But if you have integrated the sessions this way, there is often the bug that the REST-API found a bug.

WordPress Plugin

A simple plugin that works wonders: WordPress Native PHP Sessions

The plugin allows the use of PHP sessions and does not store them in a temporary folder on the server, but directly in the database. This way the sessions work even if the server does not actually support them. This is especially useful if you use certain caching methods that can bypass the sessions - but also useful to fix the REST-API bug.