• Resolved maryannk

    (@maryannkelley)


    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

    (@maryannkelley)

    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

    (@maryannkelley)

    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

    (@gabelivan)

    @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/ – 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://ww.wp.xz.cn/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

    (@maryannkelley)

    Hi @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

    (@maryannkelley)

    @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

    (@maryannkelley)

    @gabelivan any updates on this?

    Plugin Author Gabe Livan

    (@gabelivan)

    @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/

    Let me know how it goes! Make sure to clear all caching before testing!

    Thread Starter maryannk

    (@maryannkelley)

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