Custom RSS Feed Overwrites Permalink


I’m trying to setup a custom RSS feed for attachments with a meta field. I succeeded in making the feed, however it’s now overwriting the actual site content.

add_action( 'init', 'add_custom_feed' );
function add_custom_feed() {
  add_feed( 'photos', 'render_photos_feed');
function render_photos_feed() {
  //WP_Query for attachment
  get_template_part( 'rss', 'photos' );

I have a poor understanding of where exactly a url is created here. What I’m expecting is or I’m getting but then also, which is where the Page that displays my photos exists. I can flush permalinks and turn off the action for this feed and render my page, but when it’s online, I can see on the Photos page that its permalinked to photos-2. I can’t find any documentation online about why that happens.

I really don’t want to create a CPT for these, the workflow of adding a checkbox was really easy & reduces noise on the backend and the WP Query works. Secondarily, I also am wondering if it’s possible to change the main feed to be posts & photos. I can’t just hijack the feed WP_Query because its an OR logic (get posts or attachment w/ meta value). Any thoughts there are welcome too.

HarrisonFM 6 months 2021-06-07T19:21:51-05:00 0 Answers 0 views 0

Leave an answer