Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Richard Korthuis

    (@rockfire)

    Hi @igorramosg

    Thank you for using our plugin!

    In what way are you updating the data through cron? Which WP function do you use? Because if you use anything that triggers the save_post hook it should automatically clear the correct cache records.

    If you are using some kind of update mechanism that isn’t triggering the save_post hook, than you could indeed flush the records yourself using the functions you are already trying to use. However, if I look at your screenshot I see the object type is swing_trade and not ticker so are you sure you are using the correct object type?

    Thread Starter igorramosg

    (@igorramosg)

    Hi Richard! Thanks for answering.

    About the post type, it was just an example of what is happening. Actually I need to clear cache of more than one custom post type.

    For this reason, I tried to use the two ways above and the behavior was that of the attached image.

    I’ll try to change the approach a little, but what I do in my CRON is to give an update_field(), because I’m using ACF to update the values I need, I don’t use save_post().
    For example:

    update_field('potencial', 0, $post_id);

    Once the update is done, I call for each post type:

    \WP_REST_Cache_Plugin\Includes\Caching\Caching::get_instance()->delete_related_caches($post_id, post_type);

    \WP_Rest_Cache_Plugin\Includes\Caching\Caching::get_instance()->delete_object_type_caches(post_type);

    Do you have any other suggestions of what I can do?

    Thanks,

    Plugin Author Richard Korthuis

    (@rockfire)

    Hi @igorramosg

    As long as the $post_id and $post_type are correct, I don’t see any reason why this approach wouldn’t work. So all I can ask now is: are you sure the $post_id and $post_type are correct? Are you sure the cron is executed? And are you sure the caches aren’t cleared?
    I know these are all question that bring the problem back to you, but at this point I don’t see any reason why it wouldn’t work.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Problems clearing cache through CRON – Endpoint with slug’ is closed to new replies.