Beginner's Guide for WordPress - Start your WordPress Blog in minutes.
Choosing the Best
WordPress Hosting
How to Easily
Install WordPress
WordPress Plugins
View all Guides

How to Create Feed Only Content in WordPress with Shortcode

Last updated on by
Special WordPress Hosting offer for WPBeginner Readers
How to Create Feed Only Content in WordPress with Shortcode

In the past, we have shown you how to add a shortcode in WordPress. We have also shown you how to use the shortcodes in your WordPress themes. In this article, we will show you how to use shortcodes to create feed only content.

Normally, folks that read your content via feed are among your most loyal users because they usually subscribe to it one way or another. So you can offer your feed user extra information, encourage them to follow you on new venues, or even show them special offers without knowing a whole lot of code. All you have to do is open your theme’s functions.php file and paste the following code:

function feedonly_shortcode( $atts, $content = null) {
	if (!is_feed()) return "";
	return $content;
add_shortcode('feedonly', 'feedonly_shortcode');

After you have pasted this code, you can utilize it when writing your article. An example of how you would use the code would be:

[feedonly]Dear RSS readers, I’d really appreciate if you followed me on twitter (@wpbeginner).[/feedonly]

Simple, yet effective.

All credits for this post goes to Konstantin

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi. Page maintained by Syed Balkhi.

WPBeginner's Video Icon
Our HD-Quality tutorial videos for WordPress Beginners will teach you how to use WordPress to create and manage your own website in about an hour. Get started now »

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.