Skip to content

Instantly share code, notes, and snippets.

@jimboobrien
Forked from wpscholar/rss-shortcode.php
Created September 20, 2017 23:32
Show Gist options
  • Save jimboobrien/8004e8d20a05e95d7a00acfe11e15b17 to your computer and use it in GitHub Desktop.
Save jimboobrien/8004e8d20a05e95d7a00acfe11e15b17 to your computer and use it in GitHub Desktop.
WordPress shortcode allows you to create content that is visible only in your RSS feeds.
<?php
/**
* WordPress shortcode allows you to create content that is visible only in your RSS feeds.
*
* Example: [feedonly]Dear RSS readers...[/feedonly]
*/
function feedonly_shortcode( $atts, $content = null) {
if (!is_feed()) return "";
return $content;
}
add_shortcode('feedonly', 'feedonly_shortcode');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment