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

Speaks many languages, but currently only uses PHP, JavaScript and WordPress (I consider it its own language, since it's a big sandbox).
Search for a command to run...

Speaks many languages, but currently only uses PHP, JavaScript and WordPress (I consider it its own language, since it's a big sandbox).
No comments yet. Be the first to comment.
Recently, a friend asked me to send a script to remove pre tags from a string, including content. He uses a script to calculate the reading time for the content, but doesn't want the pre-tags to be included in the scoring. So if you ever have a simil...

When there are problems with one's WordPress website, it happens that one has to create a user without having access to the database or the WordPress admin. Then it is useful to be able to create or log in a user using FTP. So here you will learn how...

Occasionally it happens that overlaps occur in a large table and the message Duplicate entry '0' for key 'PRIMARY' for query then gets the upper hand in the error logs. This error can be fixed quite easily with a short line of SQL. Fix duplicate entr...

WordPress is packed with useful features. It is easy to lose the overview. Here you will find a selection of functions that deal with arrays and objects. A small collection of useful functions that you can always use, if you know that they exist. wp_...

As a rule, searches are created with the MySQL LIKE. This usually works very well, as long as the database table is not too large. However, if you work with a large database (millions+ entries), then you quickly notice how long a search in it actuall...

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.
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.
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.