Hey! Can you tell me which plugin you’re trying to Rollback when you see this error? The API response should be JSON, so I’m not sure why it’s returning HTML. Any more info would be useful.
I didn’t include that info because it appeared that any plugin would do, however, to be specific the following is just one example:
Error Log Monitor
Additionally, the GET URL (protocol = http) for the fetch appears to be:
site.on.my.lan/wp-json/wp-rollback/v1/fetch-info/?type=plugin&slug=error-log-monitor
Status Code: 404 Not Found
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL was not found on this server.</p>
</body></html>
So the above looks like why the response appears to be HTML, if I manually change the GET URL to have the host as wordpress.org and place that in my browser I get the following JSON response (just to see what happens):
{"code":"rest_no_route","message":"No route was found matching the URL and request method.","data":{"status":404}}
Not sure what else you need as to info, but this is what I have so far.
OK, now that I’ve had a little more time to look at the issue, it appears that a root install of WP is assumed. However, some WP installs are within a subfolder which is the case for this thread, meaning, manually adding the subfolder to the GET URL, e.g., site.on.my.lan/subfolder/wp-json/wp-rollback/v1/fetch-info/?type=plugin&slug=error-log-monitor
, and placing that in my browser retrieves a JSON response for the Error Log Monitor plugin.
Another point of interest and separate from this thread is WP & PHP compatibility, as a heads up, the function str_contains
found around line 476 of wp-rollback/wp-rollback.php will be a problem for some WP installs, e.g., WP branch 5.8 & PHP 7.4, of which there is not a shim/polyfill (although, one could be created/utilized within the WP Rollback plugin) for WP branch 5.8 nor a function of such defined in PHP 7.4. I bring this up because the WP Rollback plugins claims the following:
- Requires WordPress Version: 4.8 or higher
- Requires PHP Version: 7.4 or higher
As to whether there are other issues is unknown to me because I wasn’t expecting to track down bugs. Hopefully, I’ve provided you with enough info such that you can find remedies.
Hey, @emaralive, thanks for reporting the issue. I just released version 2.0.2, which fixes the str_contains issue and the REST API URL for subdirectory installs. Can you update and see if that fixes it for you?
Just finished testing both issues and version 2.0.2 appears to be a winner! Good job!!
Great! Thanks for confirming it’s working for you.