Consistent content posting not only livens up your website but also provides users with updates and educational information about your products/services. Commonly, visitors have to drop by your site to notice new articles. They can read the latest content via your social media pages too.
Do you know that RSS feeds are another intensely great method to deliver frequent content updates on your site to reach a broad audience? Our article today centers on how to create and customize an RSS feed for your WordPress.
Before digging into the detail, we can briefly discuss what an RSS really is, and why it’s so important for your site.
Let’s get the ball rolling!
RSS Feed and Its Benefits
RSS stands for Really Simple Syndication or Rich Site Summary. It appears as a simple XML text file consisting of your website’s updated content in raw format. When a veteran subscribes to an RSS feed, they can keep track of that website’s content changes without visuals.
An RSS feed contains the title of your page/post along with an excerpt including its URL, author name, and some extra information.
As a matter of fact, WordPress creates an RSS feed for every website. You can easily view it by adding ‘feed’ to your domain URL. For example, https://preventdirectaccess.com/feed.
It’s possible for you to change the link based on the feed type you want to see. They can be blog feed (https://preventdirectaccess.com/blog/feed/), category feed, or documentation feed.
Why Is RSS Feed Important?
First and foremost, RSS feeds keep track of various websites’ content updates so visitors are alerted without manually going to these sites to check them. Apart from that, RSS feeds let Google know this modification belongs to you originally.
You may not spot that content scrapers always find ways to steal your content and put it on their site. They can use software or bad bots to crawl and copy your RSS feed.
This may confuse Google with the original owner of the content. It sometimes thinks that you’re copying from other sites and gives you a penalty. This results in hurting both your brand and rankings on search engines.
As mentioned, WordPress is equipped with RSS feeds for your all site content, namely pages, posts, categories, tags, and even comments. However, there is no option to adjust its functions unless you use a plugin or edit code.
How to Edit RSS Feed Using AIOSEO Plugin
AIOSEO got you covered when it comes to an incredibly simple plugin to create a custom RSS feed. Yielding over 3 million active installs, it’s the second most popular SEO plugin for WordPress sites, just after Yoast SEO.
The plugin packs enough power to bring everything you want to achieve with RSS content and RSS sitemap. You’re allowed to add Google AdSense, link internally, and can have high converting pages in the RSS feed. Consequently, you are able to monetize your feed, increase engagement, and improve conversion rate.
Follow our guide below to get started with the plugin.
- Install and activate AIOSEO plugin for your WordPress site
- Head over to General Settings under the All in One SEO section newly added to your admin menu
- Visit the RSS Content tab
- Enter the content you wish to display before and after each RSS feed
- Save your changes
Modify RSS Feed Content Using Code
You can add some custom code to your functions.php file in order to edit your RSS feed. This method suits techies since it requires you to have good coding knowledge and skill. A tiny mistake in the functions.php file can affect your entire site performance.
Unlike AIOSEO, this solution gives you more options to customize the feed. You can enable images, schedule posts, exclude categories, or display metadata in RSS feeds.
#1 Add Custom Field Data to WordPress RSS Feed
Custom fields make it easy for you to transfer extra information about your page or post content. Unfortunately, these details won’t be carried in the RSS feed by default. To achieve that, enter the following code to your functions.php file by
- Going to Appearance → Theme Editor in your admin dashboard
- Opening functions.php in the Theme Files menu on the right side
- Entering this code to the file
function wpb_rsstutorial_customfield($content) { global $wp_query; $postid = $wp_query->post->ID; $custom_metadata = get_post_meta($postid, 'my_custom_field', true); if(is_feed()) { if($custom_metadata !== '') { // Display custom field data below content $content = $content."<br /><br /><div>".$custom_metadata."</div> "; } else { $content = $content; } } return $content; } add_filter('the_excerpt_rss', 'wpb_rsstutorial_customfield'); add_filter('the_content', 'wpb_rsstutorial_customfield');
- Updating the file
#2 Insert More Text to Post Titles in RSS Feed
You start promoting a new campaign by boosting content for it. To separate these posts from normal articles, it’s recommended to add additional text to the current titles so that readers can catch them right away. The same thing goes for guest or sponsored posts.
Similarly, all you need to do is insert this code to the functions.php file.
function wpb_rsstutorial_addtitle($content) { global $wp_query; $postid = $wp_query->post->ID; $gpost = get_post_meta($postid, 'custom_text1', true); $spost = get_post_meta($postid, 'custom_text2', true); if($gpost !== '') { $content = 'Custom Text1: '.$content; } elseif ($spost !== ''){ $content = 'Custom Text2: '.$content; } else { $content = $content; } return $content; } add_filter('the_title_rss', 'wpb_rsstutorial_addtitle');
#3 Enable Featured Images in RSS Feed
The post’s feature image won’t be displayed in RSS if you don’t tweak the feed manually. Just enter this code and let your RSS feed does wonders. It’ll firstly check if your article has a featured image, then show it up along with the post content.
function wpb_rsstutorial_featuredimage($content) { global $post; if(has_post_thumbnail($post->ID)) { $content = '<p>' . get_the_post_thumbnail($post->ID) . '</p>' . get_the_content(); } return $content; } add_filter('the_excerpt_rss', 'wpb_rsstutorial_featuredimage'); add_filter('the_content_feed', 'wpb_rsstutorial_featuredimage');
#4 Schedule Posts for RSS
WordPress will automatically add your article to the RSS feed right after being live on your site. Sometimes, you don’t want this to happen since you need time to have a final review before displaying it in the feed.
Here is the code to delay an RSS post.
function scheduled_feed($where) { global $wpdb; if ( is_feed() ) { // timestamp in WP-format $now = gmdate('Y-m-d H:i:s'); // value for wait; + device $wait = '10'; // integer // http://dev.mysql.com/doc/refman/5.0/en/date-and-time -functions.html#function_timestampdiff $device = 'MINUTE'; //MINUTE, HOUR, DAY, WEEK, MONTH, YEAR // add SQL-sytax to default $where $where .= " AND TIMESTAMPDIFF($device, $wpdb-> posts.post_date_gmt, '$now') > $wait "; } return $where; } add_filter('posts_where', 'scheduled_feed');
How to Disable RSS Feed
For small and static websites, it’s not necessary to enable your RSS feed when you rarely update content there. Luckily, disabling the RSS feed is as easy as pie by copying this code and pasting it into the functions.php file.
function wpb_disable_feed() { wp_die( __(‘No feed available,please visit our <a href=” ‘ . get_bloginfo(‘url’) . ‘ “>homepage<a/>!) ); } add_action(‘do_feed’, ‘wpb_disable_feed’, 1); add_action(‘do_feed_rdf’, ‘wpb_disable_feed’, 1); add_action(‘do_feed_rss’, ‘wpb_disable_feed’, 1); add_action(‘do_feed_rss2’, ‘wpb_disable_feed’, 1); add_action(‘do_feed_atom’, ‘wpb_disable_feed’, 1); add_action(‘do_feed_rss2_comments’, ‘wpb_disable_feed’, 1); add_action(‘do_feed_atom_comments’, ‘wpb_disable_feed’, 1);
Modify WordPress RSS Feed Like a Pro!
Although WordPress offers a built-in RSS feed to have all your content updates, it’s crucial to customize them to deliver the best experience to users. At the same time, it also helps credit your content with Google to ensure it is original.
We’ve walked your way up to 2 solutions to edit RSS feed, either using AIOSEO plugin or adding code to the functions.php file. The AIOSEO plugin assists in inserting content to all items in your WordPress feed. The manual method, on the other hand, enables you to add different content types to the feed, from custom fields to featured images.
Ready to customize your WordPress RSS feed yet? Share with us your experience in the comment section below. You can also check out our article on how to fix the WordPress RSS feed not working.