Title: wp-json REST API broken
Last modified: April 15, 2021

---

# wp-json REST API broken

 *  Resolved [maryannk](https://wordpress.org/support/users/maryannkelley/)
 * (@maryannkelley)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/wp-json-rest-api-broken/)
 * In setting up Asset Cleanup, I tried out different configurations. I did not 
   realize that I needed the REST API for use by the Search Regex plugin when I 
   initially set up the Asset Cleanup options.
 * Now when I disable the “Remove “REST API” link tag?” option in HTML Source CleanUp,
   the REST API remains broken. I’ve cleared the Asset Cleanup cache and the WP 
   Rocket Cache to no avail.
 * I tried deleting the Asset Cleanup plugin and reinstalling, but it does not clean
   up after itself in the options table apparently, because upon reactivation after
   reinstalling, the options are all prefilled. I went into the options table and
   deleted all items associated with wpassetcleanup_ but Search Regex still can’t
   access the REST API. As soon as I deactivate Asset Cleanup, the problem is gone.
 * The associated error is:
    Error: Unexpected end of JSON input (SyntaxError)
 * I’m running:
    WordPress: 5.6.2 (single) PHP: 7.3.27 256M 30s
 * I’d really like to use your plugin, but I need the REST API available.

Viewing 8 replies - 1 through 8 (of 8 total)

 *  Thread Starter [maryannk](https://wordpress.org/support/users/maryannkelley/)
 * (@maryannkelley)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/wp-json-rest-api-broken/#post-14397168)
 * Can I get some help with this? I would really like to use the plugin but have
   had to disable it because the broken REST is breaking another function of my 
   site.
 *  Thread Starter [maryannk](https://wordpress.org/support/users/maryannkelley/)
 * (@maryannkelley)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/wp-json-rest-api-broken/#post-14398400)
 * Doing a file compare, the wp-json file is about ⅓ of the length of the full file
   when Asset Cleanup is enabled. This backs up the “unexpected end of JSON file”
   error I am getting.
 * I have tried:
    – Disabling the Remove “REST API” link tag? in the HTML Source
   Cleanup section – Resetting all settings (including checking both boxes) in the
   Tools section – Manually deleting the Asset Cleanup cache folder in wp-content–
   Deleting and reinstalling the plugin after resetting all settings
 * Deactivating the Asset Cleanup plugin restores the full JSON file and functionality
   of all features of the site dependent on the REST API.
 * It seems like this should be an easy setting to fix, I just don’t know what it
   would be. I’ve combed the database tables looking for something that might be
   leftover that could be causing it and can find nothing. I would really appreciate
   your input as to what might be causing this.
 *  Plugin Author [Gabe Livan](https://wordpress.org/support/users/gabelivan/)
 * (@gabelivan)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/wp-json-rest-api-broken/#post-14398466)
 * [@maryannkelley](https://wordpress.org/support/users/maryannkelley/) I’m checking
   this right now. As I’m away for the Easter holidays and other guys didn’t reply
   yet to this thread, there is a delay in the response from myself as the tickets
   related to the Pro version usually have priority especially when it comes to 
   weekends and other known holidays. Somehow this ticket was missed (there were
   plenty lately), but I’m on it now and definitely it will get fixed if it’s a 
   bug.
 * Now, which _wp-json_ file are you referring? Can you let us know the relative
   path to it (without your domain name). If you feel comfortable sharing the full
   URL here, you can do so, otherwise, you can write to me via [https://www.gabelivan.com/contact/](https://www.gabelivan.com/contact/)–
   I have to admit this is a strange bug and the last time someone mentioned a broken
   REST was last year during the summer and it got fixed eventually: [https://wordpress.org/support/topic/asset-cleanup-breaks-woocommerce-rest-api/](https://wordpress.org/support/topic/asset-cleanup-breaks-woocommerce-rest-api/)
 * Are you using WooCommerce? I definitely need more information about your website.
   You can attach (if you fill the form from the URL I mentioned) the “System Info”
   you can find in “Tools” (plugin’s menu).
 * After I’ll check it out, I’ll update this topic with my findings so others will
   be able to read it if they have the same problem 😉
 *  Thread Starter [maryannk](https://wordpress.org/support/users/maryannkelley/)
 * (@maryannkelley)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/wp-json-rest-api-broken/#post-14398483)
 * Hi [@gabelivan](https://wordpress.org/support/users/gabelivan/) – Thanks for 
   getting back to me. I will send you the details via your contact page. I am not
   using Woo Commerce but I am using WP Recipe Maker (which is also based on a CPT).
   Both WP Recipe Maker and Search Regex are broken with the plugin active, and 
   as I mentioned the wp-json file is truncated when it is active.
 *  Thread Starter [maryannk](https://wordpress.org/support/users/maryannkelley/)
 * (@maryannkelley)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/wp-json-rest-api-broken/#post-14398608)
 * [@gabelivan](https://wordpress.org/support/users/gabelivan/) I just realized 
   that I had the files reversed – the wp-json file when the plugin is deactivated
   is the shorter file. When the plugin is active, it appears to repeat the same
   content multiple times. I sent you both files via the contact form, and the plugin
   is currently active on the domain that I included I that submission.
 *  Thread Starter [maryannk](https://wordpress.org/support/users/maryannkelley/)
 * (@maryannkelley)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/wp-json-rest-api-broken/#post-14406985)
 * [@gabelivan](https://wordpress.org/support/users/gabelivan/) any updates on this?
 *  Plugin Author [Gabe Livan](https://wordpress.org/support/users/gabelivan/)
 * (@gabelivan)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/wp-json-rest-api-broken/#post-14407309)
 * [@maryannkelley](https://wordpress.org/support/users/maryannkelley/) I’ve analyzed
   the JSON files you provided, though I couldn’t find any functions from Asset 
   CleanUp that would interfere with it. I have to admit it’s a strange one, but
   who knows, it could affect other users as well. What I’ve done was to change 
   the plugin to have higher accuracy in detecting REST requests. In this case, 
   the plugin shouldn’t trigger at all. I made a few tests on my end and it works
   fine.
 * What you can do is download the development version that was just updated and
   install it on your staging site (just delete the current version you have, no
   worries, all settings will be preserved). For a step by step tutorial, you can
   check this post: [https://www.assetcleanup.com/docs/how-to-get-the-development-version-of-asset-cleanup/](https://www.assetcleanup.com/docs/how-to-get-the-development-version-of-asset-cleanup/)
 * Let me know how it goes! Make sure to clear all caching before testing!
 *  Thread Starter [maryannk](https://wordpress.org/support/users/maryannkelley/)
 * (@maryannkelley)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/wp-json-rest-api-broken/#post-14407413)
 * [@gabelivan](https://wordpress.org/support/users/gabelivan/) that worked perfectly.
   Thank you so much!

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘wp-json REST API broken’ is closed to new replies.

 * ![](https://ps.w.org/wp-asset-clean-up/assets/icon-256x256.png?rev=1981952)
 * [Asset CleanUp: Page Speed Booster](https://wordpress.org/plugins/wp-asset-clean-up/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-asset-clean-up/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-asset-clean-up/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-asset-clean-up/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-asset-clean-up/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-asset-clean-up/reviews/)

## Tags

 * [cache](https://wordpress.org/support/topic-tag/cache/)

 * 8 replies
 * 3 participants
 * Last reply from: [maryannk](https://wordpress.org/support/users/maryannkelley/)
 * Last activity: [5 years, 1 month ago](https://wordpress.org/support/topic/wp-json-rest-api-broken/#post-14407413)
 * Status: resolved