Title: [Plugin: WP Super Cache] Custom PHP code executed before serving cache page
Last modified: August 19, 2016

---

# [Plugin: WP Super Cache] Custom PHP code executed before serving cache page

 *  [LucaTNT](https://wordpress.org/support/users/lucatnt/)
 * (@lucatnt)
 * [17 years, 10 months ago](https://wordpress.org/support/topic/plugin-wp-super-cache-custom-php-code-executed-before-serving-cache-page/)
 * Hi everyone!
    I’ve been testing WP Super Cache for a while, and it’s great!
 * If I can make a request, I would like the cached page to be served through a 
   PHP page, so that I can put some code in it to be executed *every* time a page
   is served.
    Would this be possibile?
 * Thanks in advance and greetings from Italy!
 * Luca

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

 *  [Donncha O Caoimh (a11n)](https://wordpress.org/support/users/donncha/)
 * (@donncha)
 * [17 years, 10 months ago](https://wordpress.org/support/topic/plugin-wp-super-cache-custom-php-code-executed-before-serving-cache-page/#post-829366)
 * Just make sure the plugin is switched to “Half on” and use one of the cacheaction
   hooks to execute your code. Look in the plugins directory and at wp-cache-phase1.
   php for example code.
 *  Thread Starter [LucaTNT](https://wordpress.org/support/users/lucatnt/)
 * (@lucatnt)
 * [17 years, 10 months ago](https://wordpress.org/support/topic/plugin-wp-super-cache-custom-php-code-executed-before-serving-cache-page/#post-829589)
 * Thank you for your reply.
 * I’m not a PHP newbie, but I’m not used to work on wordpress.
    Could you be so
   kind as to give me an example of how to make some code be executed after each
   page (cached or not, excepting admin area) is executed? So far I only managed
   to execute the code when the cache is created.
 * Thanks in advance,
    Luca
 *  Thread Starter [LucaTNT](https://wordpress.org/support/users/lucatnt/)
 * (@lucatnt)
 * [17 years, 10 months ago](https://wordpress.org/support/topic/plugin-wp-super-cache-custom-php-code-executed-before-serving-cache-page/#post-829658)
 * UP
 * Can anyone help me?
 *  [pavelzin](https://wordpress.org/support/users/pavelzin/)
 * (@pavelzin)
 * [17 years, 10 months ago](https://wordpress.org/support/topic/plugin-wp-super-cache-custom-php-code-executed-before-serving-cache-page/#post-829670)
 * Yeah, some problem here. Anyone?
 * What I’m trying to do is to execute a php script every time a page is loaded.
   So in other words – is there a way, to – for example – not cache footer.php in
   the template file?
 *  [Donncha O Caoimh (a11n)](https://wordpress.org/support/users/donncha/)
 * (@donncha)
 * [17 years, 10 months ago](https://wordpress.org/support/topic/plugin-wp-super-cache-custom-php-code-executed-before-serving-cache-page/#post-829671)
 * LucaTNT – Sorry, I don’t have time to go through it.
 * Pavelzin – you could use an img tag to load a php script?
 *  Thread Starter [LucaTNT](https://wordpress.org/support/users/lucatnt/)
 * (@lucatnt)
 * [17 years, 10 months ago](https://wordpress.org/support/topic/plugin-wp-super-cache-custom-php-code-executed-before-serving-cache-page/#post-829672)
 * Donncha – Ok, thank you anyway.
 * If any other knows how to do it, please let me know.

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

The topic ‘[Plugin: WP Super Cache] Custom PHP code executed before serving cache
page’ is closed to new replies.

 * In: [Requests and Feedback](https://wordpress.org/support/forum/requests-and-feedback/)
 * 6 replies
 * 3 participants
 * Last reply from: [LucaTNT](https://wordpress.org/support/users/lucatnt/)
 * Last activity: [17 years, 10 months ago](https://wordpress.org/support/topic/plugin-wp-super-cache-custom-php-code-executed-before-serving-cache-page/#post-829672)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
