Skip to main content
added 8 characters in body
Source Link

I'm trying to setup a custom RSS feed for an attachmentattachments 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 example.com/photos/feedexample.com/photos/feed or example.com/feed/photosexample.com/feed/photos. I'm getting example.com/feed/photosexample.com/feed/photos but then also example.com/photosexample.com/photos, 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-2photos-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.

I'm trying to setup a custom RSS feed for an attachment 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 example.com/photos/feed or example.com/feed/photos. I'm getting example.com/feed/photos but then also example.com/photos, 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.

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 example.com/photos/feed or example.com/feed/photos. I'm getting example.com/feed/photos but then also example.com/photos, 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.

Source Link

Custom RSS Feed Overwrites Permalink

I'm trying to setup a custom RSS feed for an attachment 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 example.com/photos/feed or example.com/feed/photos. I'm getting example.com/feed/photos but then also example.com/photos, 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.