Title: Programmatically preload page cache
Last modified: January 23, 2018

---

# Programmatically preload page cache

 *  [skarck](https://wordpress.org/support/users/skarck/)
 * (@skarck)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/programmatically-preload-page-cache/)
 * Is there a way to programmatically trigger preloading of the page cache? (Speaking
   of the functionality configured under “Cache preload” in the settings)?

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

 *  [Mikhail Alferov](https://wordpress.org/support/users/malferov/)
 * (@malferov)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/programmatically-preload-page-cache/#post-9901207)
 * +1
 * I use custom function for flush page from cache:
 *     ```
       function my_w3tc_flush_page_by_url() {
         $post_url = get_permalink($post_id);
         if ( function_exists('w3tc_flush_url') ) {
           w3tc_flush_url( $post_url );
         }
       }
       ```
   
 * Is there a way to do the reverse action? That is to programmatically create a
   cache of a page by its URL?
    -  This reply was modified 8 years, 4 months ago by [Mikhail Alferov](https://wordpress.org/support/users/malferov/).
 *  Thread Starter [skarck](https://wordpress.org/support/users/skarck/)
 * (@skarck)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/programmatically-preload-page-cache/#post-10469084)
 * thanks [@mamunur34](https://wordpress.org/support/users/mamunur34/) ! but it 
   only seems to prime the cache for the given post ID. Was more looking for a way
   to trigger the functionality defined in the W3TC settings including pages in 
   the sitemaps etc… .

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

The topic ‘Programmatically preload page cache’ is closed to new replies.

 * ![](https://ps.w.org/w3-total-cache/assets/icon-256x256.png?rev=1041806)
 * [W3 Total Cache](https://wordpress.org/plugins/w3-total-cache/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/w3-total-cache/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/w3-total-cache/)
 * [Active Topics](https://wordpress.org/support/plugin/w3-total-cache/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/w3-total-cache/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/w3-total-cache/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [skarck](https://wordpress.org/support/users/skarck/)
 * Last activity: [7 years, 11 months ago](https://wordpress.org/support/topic/programmatically-preload-page-cache/#post-10469084)
 * Status: not resolved