# Send Feed Readers to Your Feed Service

> Redirects visitors and feed readers from your main feed to its address at a feed service such as FeedPress or Follow.it, while the service itself still reads your real feed.

- Type: PHP
- Runs: Run everywhere
- Category: [RSS Feeds](https://wpide.com/library/category/rss/)
- Tags: feeds, redirects, subscribers
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/redirect-feed-to-feed-service/

## Code

```php
// Your feed's address at the feed service (FeedPress, Follow.it, Feedburner ...). Leave empty to turn the redirect off.
$wpide_feed_service_url = '';
// Parts of the service's user agent; these requests get your real feed so the service can read it.
$wpide_feed_service_agents = array( 'feedpress', 'feedburner', 'follow.it', 'feedvalidator' );

add_action( 'template_redirect', function () use ( $wpide_feed_service_url, $wpide_feed_service_agents ) {
    if ( '' === $wpide_feed_service_url || ! is_feed() || is_comment_feed() || is_archive() || is_search() || is_singular() ) {
        return;
    }

    // The service can also read the original feed at /feed/?origin-feed=1.
    if ( isset( $_GET['origin-feed'] ) ) {
        return;
    }

    $agent = isset( $_SERVER['HTTP_USER_AGENT'] ) ? strtolower( sanitize_text_field( wp_unslash( $_SERVER['HTTP_USER_AGENT'] ) ) ) : '';

    foreach ( $wpide_feed_service_agents as $needle ) {
        if ( '' !== $agent && false !== strpos( $agent, strtolower( $needle ) ) ) {
            return;
        }
    }

    // 302 keeps subscribers on your own feed address, so you can switch services later.
    wp_redirect( esc_url_raw( $wpide_feed_service_url ), 302 ); // phpcs:ignore WordPress.Security.SafeRedirect -- external address set by the site owner.
    exit;
}, 1 );
```

## Notes

Off until you fill in the service address. Point the service at /feed/?origin-feed=1 if its user agent is not in the list.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Send Feed Readers to Your Feed Service" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
