Support » Plugin: WP REST Cache » Adding New Post and Updating Post takes long time

  • Resolved arindam4u



    I have noticed some issues recently. When I click on Add New post button and update any post it takes so long time to process. I have not added any plugins recently.
    With Query Monitor I’ve got this result. WP-REST-CACHE

    Can you tell me what causing this trouble.
    Please note: Cache, Front End Works fast. only Adding Posts (Not Pages) and Updating causing this error.

    Thanks in advance.

Viewing 8 replies - 1 through 8 (of 8 total)
    After deactivating the plugin and reactivating it again solved the long waiting. However, whenever I click Add New Post button every caches flushed automatically. No posts updated.
    Just clicking on Add New Post flushing all the caches. I don’t have any clue why is this happening.
    My setting:

    setting<br />
    Any help will be great.

    • This reply was modified 1 year, 3 months ago by arindam4u.
    • This reply was modified 1 year, 3 months ago by arindam4u.
    Plugin Author Richard Korthuis


    Hello @arindam4u

    Thank you for your questions. First of all why it took so long time to process the Add New Post and update any post: It has probably little to do with the query that is shown by Query Monitor, since that query is still not very slow. It was probably caused by the fact that you had a lot of ‘overview’ caches for posts. Whenever a post is edited or added all those ‘overview’ caches need to be flushed, since they (might) change. We are going to investigate and try to find a solution to have it not slow down the process this much.
    The fact that your caches are flushed when you click Add New Post has to do with the fact that WordPress fires the save_post hook when that page is loaded. So this is in fact a bug and we should check if indeed a new post has been added so the caches will not get flushed until one has been actually added.

    I will let you know once we have implemented a fix for this.

    @rockfire Thank you so much for your time and your reply.
    I will be waiting for the fix.

    @rockfire Can you please tell me how to disable auto flushing cache of default WP REST API for now until you find a fix. Cause it makes things really out of hand.

    Plugin Author Richard Korthuis


    Hi @arindam4u

    I am sorry to hear you are having troubles. This week I am out of the office due to a holiday, so I don’t expect to be able to release a fix this week.

    Unfortunately there isn’t a hook or setting you can use to temporary disable auto flushing. What you can do to disable it is edit the file /includes/class-plugin.php and comment out the lines starting with
    add_action( 'save_post', [ $caching, 'save_post' ], 999, 3 );
    until the line
    add_action( 'comment_post', [ $caching, 'delete_comment_type_related_caches' ], 999, 2 );
    So lines 143 – 162, that will disable the auto flushing.

    @rockfire Thank you so much! It worked and it will do for now until the problem is solved.

    Thanks again.

    Plugin Author Richard Korthuis


    Hi @arindam4u

    This should now be solved in the latest version of our plugin.

    Thank you so much for your help and support.
    The problem is solved.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Adding New Post and Updating Post takes long time’ is closed to new replies.