links – How to have all RSS feed entries linking to the same specific page
Here’s an example of how you can use the the_permalink_rss
filter to modify the link for each custom post type in the RSS feed:
add_filter( 'the_permalink_rss', 'wpm_modify_rss_link' );
function wpm_modify_rss_link( $link ) {
if ( get_post_type() == 'Evenements' ) {
$link = get_site_url() . '/de/aktivitaeten/';
}
return $link;
}
This code will filter the link for each custom post type in the RSS feed and set it to the desired URL.
Note: Make sure to replace get_site_url() . '/de/aktivitaeten/'
with the actual URL that you want to use for the link.
Using the is_feed(
) function to conditionally modify the link for custom post types in the RSS feed is also a good approach. You can use the is_feed()
function to check if the current request is for an RSS feed, and then modify the link accordingly.
Here’s an example of how you can use the is_feed()
function to modify the link for each custom post type in the RSS feed:
add_filter( 'the_permalink_rss', 'wpm_modify_rss_link' );
function wpm_modify_rss_link( $link ) {
if ( is_feed() && get_post_type() == 'Evenements' ) {
$link = get_site_url() . '/de/aktivitaeten/';
}
return $link;
}
This code will only modify the link for custom post types in the RSS feed, and will set the link to the desired URL.
Note: Make sure to replace get_site_url() . '/de/aktivitaeten/'
with the actual URL that you want to use for the link.
Leave an answer