Using WordPress ‘load_feed_engine’ PHP action

The load_feed_engine WordPress PHP action fires before MagpieRSS is loaded, allowing you to optionally replace it.

Usage

add_action('load_feed_engine', 'your_custom_function');
function your_custom_function() {
    // your custom code here
}

Parameters

  • None

More information

See WordPress Developer Resources: load_feed_engine

Examples

Replacing MagpieRSS with SimplePie

Replace the default MagpieRSS feed engine with SimplePie:

add_action('load_feed_engine', 'replace_with_simplepie');
function replace_with_simplepie() {
    if (!class_exists('SimplePie')) {
        require_once('path/to/simplepie/simplepie.inc');
    }
}

Customizing the cache duration of MagpieRSS

Extend the cache duration for MagpieRSS:

add_action('load_feed_engine', 'extend_magpie_cache_duration');
function extend_magpie_cache_duration() {
    define('MAGPIE_CACHE_AGE', 3600 * 12); // 12 hours
}

Disabling caching for MagpieRSS

Disable caching for MagpieRSS:

add_action('load_feed_engine', 'disable_magpie_cache');
function disable_magpie_cache() {
    define('MAGPIE_CACHE_ON', false);
}

Loading a custom feed engine

Load a custom feed engine:

add_action('load_feed_engine', 'load_custom_feed_engine');
function load_custom_feed_engine() {
    require_once('path/to/your/custom/feed/engine.php');
}

Replacing MagpieRSS with a custom feed engine class

Replace MagpieRSS with a custom feed engine class:

add_action('load_feed_engine', 'replace_with_custom_feed_engine');
function replace_with_custom_feed_engine() {
    require_once('path/to/your/custom/feed/engine.php');
    class RSSCache extends Custom_Feed_Engine_Cache {}
}