Clear the Cache by Calling the Function Hook

You can clear the cache by calling the following functions. You can use them outside of the plugin.

You can clear all the cache with the following functions. The function takes only 1 parameter. The rebuild cache operation is successively called if you enabled the preload option.

and You can delete the cache of a post, a page or a custom page by calling the function. The function takes only 1 parameter. You need to enter the id of the content. The cache of post’s tags, archive and category are cleared as well.

If you are using WPML plugin, you need to disable the Make themes work multilingual option as below. Otherwise, it returns the default language url.

Executing a Function After Clearing Cache

You can run your function after clearing cache with add_action() method.