# Feed-Only and Hide-in-Feed Shortcodes

> Adds [feed_only] and [hide_in_feed] shortcodes, so you can show a special message to RSS subscribers or keep interactive parts of a post out of feeds.

- Type: PHP
- Runs: Run everywhere
- Category: [RSS Feeds](https://wpide.com/library/category/rss/)
- Tags: rss, shortcode, content
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/feed-only-content-shortcodes/

## Code

```php
add_shortcode( 'feed_only', function ( $atts, $content = '' ) {
    return is_feed() ? do_shortcode( (string) $content ) : '';
} );

add_shortcode( 'hide_in_feed', function ( $atts, $content = '' ) {
    return is_feed() ? '' : do_shortcode( (string) $content );
} );
```

## Notes

Example: [hide_in_feed]Interactive calculator here[/hide_in_feed][feed_only]Visit the post to use the calculator.[/feed_only]

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Feed-Only and Hide-in-Feed Shortcodes" 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/
