Add Custom Post Type into the Feed

Advertisement

WordPress provide the reed support with URL. We can see the site feed with below URL pattern:

https://mywebsite.com/feed/

The /feed/ is generated from the WordPress PHP file wp-includes\feed-rss2.php

The have_posts() loop is executed while generating the feed. So, We can use the filter pre_get_posts to show our custom post type feed.

Below is the sample code which add the post, astra-portfolio, and deal post types into the feed.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: