SOLUTION: Resolve the 500 server error when publishing new posts
-
For those still using this plugin, you’ve probably seen a HTTP 500 error when publishing a new post. The post publishes just fine, but for some reason, WordPress issues an error rather than redirecting you back to the post editor the way it’s supposed to do.
This is due to a bug in an event that fires the first time a post is published.
Normally I would advise against editing a plugin, but since the developer has discontinued support, it may not be a bad idea in this particular case.
If you look on Line 927 of the main PHP file for the plugin, you’ll see something similar to the following:
$response = json_decode($zemanta_response['body']); if (isset($response->status) !is_wp_error($zemanta_response)) { $status = $response->status; }
That
$zemata_response['body']
); is what’s causing the error. You’ll see on the next line that the plugin developer excepted that variable to be aWP_Error
sometimes, because they actually check to make sure that it’s not. The problem is, they are trying to access a value from an array before making sure that it <string>is.If you change that chunk of code to the following:
if (!is_wp_error($zemanta_response) && isset($response->status)) { $response = json_decode($zemanta_response['body']); $status = $response->status; }
The plugin will check to make sure the variable is not a
WP_Error
first, and then it will continue processing. If it is an error, the event will stop, and you will no longer see the HTTP 500 error on publishing new posts.
- The topic ‘SOLUTION: Resolve the 500 server error when publishing new posts’ is closed to new replies.