Skip to content

Instantly share code, notes, and snippets.

@wpscholar
Last active September 20, 2017 23:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save wpscholar/1242556 to your computer and use it in GitHub Desktop.
Save wpscholar/1242556 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