Link to Enclosure

The Link to Enclosure option works differently when Feed to Post is enabled.

In the core plugin, it makes feed items link to the enclosure link, rather than the original article.

In Feed to Post, the enclosure link is added to the post content, at the beginning as a link.

The output of the enclosure link can be changed through the use of the filter below. The filter accepts 3 arguments, which are:

  • output:
    The current text/HTML output. By default, this will be an <a> tag, with its href link pointing to the enclosure, and its text set to the enclosure link.
  • enclosure:
    The enclosure link URL for the current imported post being shown on the site.
  • source:
    The ID of the feed source, from which the imported post was imported.

You can use these parameters in your filter function to set the output of the enclosure to whatever you want.

The example below shows how all the parameters can be used:

By default, the enclosure link output is added to the post content, before the post’s original content. If you wish to add the output after the content, use the following filter:

The filter should return either “before” or “after“.