Skip to content

Instantly share code, notes, and snippets.

@wpmudev-sls
Last active November 14, 2019 13:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wpmudev-sls/e8110abdcb16feac2f40a35642dc2b95 to your computer and use it in GitHub Desktop.
Save wpmudev-sls/e8110abdcb16feac2f40a35642dc2b95 to your computer and use it in GitHub Desktop.
[Hummingbird Pro] - Exclude feeds from cache feeds
<?php
/**
* Plugin Name: [Hummingbird Pro] - Exclude feeds from cache feeds
* Description: [Hummingbird Pro] - Exclude feeds from cache feeds - 1148917558774513
* Author: Thobk @ WPMUDEV
* Author URI: https://premium.wpmudev.org
* License: GPLv2 or later
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
add_action( 'plugins_loaded', 'wpmudev_hmbp_exclude_feeds_from_cache_feeds_func', 100 );
function wpmudev_hmbp_exclude_feeds_from_cache_feeds_func() {
// if you want to copy to your child theme's functions.php file, please start here:
if( defined('WPHB_VERSION') && class_exists( 'Hummingbird\WP_Hummingbird' ) && class_exists('Hummingbird\Core\Settings') ){
if( ! Hummingbird\Core\Settings::get_setting( 'enabled', 'rss' ) ){
return;
}
add_action( 'wp_feed_options', 'wpmudev_hmbp_exclude_feeds_from_cache_feeds', 99, 2 );
function wpmudev_hmbp_exclude_feeds_from_cache_feeds( $feed, $url ){
// Enter list feeds url which you want to disable the cache here, separated by comma (,)
$disabled_feed_urls = array(
// 'http://www.cbn.com/cbnnews/world/feed/'
);
if( in_array( $url, $disabled_feed_urls ) ){
$feed->enable_cache( false );
}
}
}
// and end here
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment