Support » Plugins » Hacks » WordPress SimplePie Modifications

  • I am using the fetch_feed() function provided in WordPress to build a SimplePie feed object.

    The code from WP is the following:

    function fetch_feed($url) {
    require_once (ABSPATH . WPINC . '/class-feed.php');
    $feed = new SimplePie();
    $feed->set_sanitize_class( 'WP_SimplePie_Sanitize_KSES' );
    // We must manually overwrite $feed->sanitize because SimplePie's
    // constructor sets it before we have a chance to set the sanitization class
    $feed->sanitize = new WP_SimplePie_Sanitize_KSES();
    $feed->set_cache_class( 'WP_Feed_Cache' );
    $feed->set_file_class( 'WP_SimplePie_File' );
    $feed->set_cache_duration( apply_filters( 'wp_feed_cache_transient_lifetime', 12 * HOUR_IN_SECONDS, $url ) );
    do_action_ref_array( 'wp_feed_options', array( &$feed, $url ) );
    if ( $feed->error() )
        return new WP_Error('simplepie-error', $feed->error());
    return $feed;

    How can I modify which HTML elements get stripped during the feed import?

    SimplePie in its documentation says that there is a function strip_htmltags(), but I’m not sure how I can use it within the WordPress context.

  • The topic ‘WordPress SimplePie Modifications’ is closed to new replies.