Created
September 5, 2012 15:50
-
-
Save jeremyfelt/3638823 to your computer and use it in GitHub Desktop.
WP Feed Cache Transient Sample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function my_function_that_grabs_the_feed() { | |
add_filter( 'wp_feed_cache_transient_lifetime', 'modify_feed_cache' ); | |
$my_feed = fetch_feed( esc_url( $feed_url ) ); | |
remove_filter( 'wp_feed_cache_transient_lifetime', 'modify_feed_cache' ); | |
} | |
function modify_feed_cache() { | |
return 30; // seconds | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment