fb-instant-articles
fb-instant-articles copied to clipboard
Updating failed. Unexpected token < in JSON at position 0
Steps required to reproduce the problem
- Update article post without using classic editor
- When updating, a response will show Updating failed. Unexpected token < in JSON at position 0
- Although the article has updated
- If you update a post in the old classic editor, you do not get this error which suggests its WordPress new editor causing this issue.
Expected Result
Actual Result
IUpdating failed. Unexpected token < in JSON at position 0
Version Info
4.2.1 for the plugin Wordpress 5.6.2 PHP 7.4
Any ideas on how to prevent this popup? As we'd prefer to use the new editor in WordPress and not classic.
It seems this issue has never been fixed with #1009 - Disappointing the developers have not bothered.
Having the same issues. In my case, the cause is a response from Facebook saying the application has not yet been authorized.
The plugin appears to be printing the warning from facebook inside of the JSON response sent after updating the post.
Setting define( 'WP_DEBUG', false ); or error_reporting( null ); is not enough to suppress the warning message.
I believe the offending lines are here:
https://github.com/Automattic/facebook-instant-articles-wp/blob/master/facebook-instant-articles.php#L522-L523
That code seems odd - there's no </pre> for instance, and random output from a graph call doesn't seem logical in that context. The code has been removed in https://github.com/Automattic/fb-instant-articles/commit/6275d09a6861169ac23d7d6d4a473c868579925b.