If your website content is frequently copied, or if other sites scrape your new posts as soon as they are published, you might need to disable WordPress RSS feeds to prevent your content from being automatically pulled by other websites.
Before we do that, let us briefly discuss what an RSS feed is in WordPress.
What is a WordPress RSS feed?
An RSS feed in WordPress is a feature used to provide easier access to website content in a summary format that is easily understood by computers.
For example, when you add new content to your website, the RSS feed will notify those who have subscribed to your RSS, allowing them to get updates faster without having to constantly visit your website.
However, because of this convenience, some parties use this feature with RSS aggregators to copy your latest website content onto their own sites.
If you do not need this feature, you can deactivate or disable the RSS feed on your WordPress site by following a few simple steps.
Since this method requires updating the functions.php file in your active theme, it is recommended to use a Child Theme so that your changes are not lost when you update your theme. [How to Create a WordPress Child Theme].
How to Disable WordPress RSS Feeds
Before making any changes, make sure to check if your website actually has an RSS feed by accessing yourdomain.tld/rss, for example https://staging.wpgan.com/rss.
You also need to ensure that the theme you are using supports changes to functions.php, as newer themes like Twenty Twenty-Four do not support this feature.
Once confirmed, you can follow these steps to disable your WordPress RSS feed
- Log in to your WordPress dashboard as an admin. By default, you can log in via yourdomain.tld/login (replace yourdomain.tld with your actual domain name)
- Go to Appearance > Theme File Editor
- Select Theme Functions to edit the functions.php file
- Add the following code to the very end of the file, then save your changes to the functions file
/** * Menampilkan pesan khusus ketika halaman RSS diakses. * * @return void */function wpg_disable_rss() { wp_die( sprintf( // Translators: Placeholders for the homepage link. esc_html__( 'RSS Feed tidak tersedia, Kunjungi %1$shomepage%2$s!' ), ' <a href="' . esc_url( home_url( '/' ) ) . '">', '</a>' ) );}
// Mengubah semua RSS Feed dengan pesan diatas.add_action( 'do_feed_rdf', 'wpg_disable_rss', 1 );add_action( 'do_feed_rss', 'wpg_disable_rss', 1 );add_action( 'do_feed_rss2', 'wpg_disable_rss', 1 );add_action( 'do_feed_atom', 'wpg_disable_rss', 1 );add_action( 'do_feed_rss2_comments', 'wpg_disable_rss', 1 );add_action( 'do_feed_atom_comments', 'wpg_disable_rss', 1 );// Menghapus link RSS Feed dari Header.remove_action( 'wp_head', 'feed_links_extra', 3 );remove_action( 'wp_head', 'feed_links', 2 );After saving your changes, try accessing the RSS page on your website (yourdomain.tld/rss). The result should now look like this
However, if you receive this message when saving changes to the functions file Unable to communicate back with site to check for fatal errors, so the PHP change was reverted, you can add the code via File Manager or FTP, or you can fix your website by following this tutorial: How to Fix the WordPress Unable to communicate back with site to check for fatal errors Error.
COMMENTS
Loading...