• Resolved Christoph

    (@camthor)


    Hi,

    I would like to change the RSS feed so that <link></link> does not contain the link to the post but to an external source. When readers load the feed they would see the post’s title and text/abstract but when they click on the title they would go to that external source. (I need that for Mailchimp’s regular newsletters that draw their information from a feed.)

    Ideally this would work together with the post format “link” so that the first URL in the content could be used.

    I’m aware of the filter the_content_feed and the possibility to add own templates to /wp-includes/ (and probably lose them with the next update) but I actually don’t want to change the content but only <link> element. I’d also prefer to avoid setting up redirections for each post permalink.

    Any ideas how to achieve that? Thanks!

    • This topic was modified 5 years, 1 month ago by Christoph. Reason: editor removed a part of the title
Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz

    (@bcworkz)

    The link element is really part of the feed’s content, so you would need to alter the default template. But you don’t do that directly because your changes will be lost during updates as you suspect. Work on a copy of the default feed-rss2.php template and store it in either a child theme or a custom plugin. For specifics on how to cause your template to be used instead of the default, see Customnizing Feeds.

    The get_template_part() function in the example code only works for themes. If you keep your template in a plugin, use something like
    require( plugin_dir_path( __FILE__ ) . "my-rss2-template.php" );

    Thread Starter Christoph

    (@camthor)

    Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Use external URL in feed’s link element’ is closed to new replies.