set_sanitize_class example

function fetch_feed( $url ) {
    if ( ! class_exists( 'SimplePie', false ) ) {
        require_once ABSPATH . WPINC . '/class-simplepie.php';
    }

    require_once ABSPATH . WPINC . '/class-wp-feed-cache-transient.php';
    require_once ABSPATH . WPINC . '/class-wp-simplepie-file.php';
    require_once ABSPATH . WPINC . '/class-wp-simplepie-sanitize-kses.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();

    // Register the cache handler using the recommended method for SimplePie 1.3 or later.     if ( method_exists( 'SimplePie_Cache', 'register' ) ) {
        SimplePie_Cache::register( 'wp_transient', 'WP_Feed_Cache_Transient' );
        $feed->set_cache_location( 'wp_transient' );
    } else {
        
Home | Imprint | This part of the site doesn't use cookies.