Make post titles link to the original article (source)

To copy these filters, click the “Copy” button on the right of the grey bar on top, and follow the instructions.

By default, the post titles are linked to the single post, and by adding this filter they are linked to the original source with a click behaviour that opens in the same tab. The ability to have these post titles open in a new tab or window is controlled by your theme, not WP RSS Aggregator.

OPTION 1: The filter below will make post titles link to the original article when showing multiple posts on your site (homepage, categories page, search page, etc):

OPTION 2: You can alternatively apply the filter to posts from specific feed sources only, by using a filter function to return an array containing the IDs of these feed sources:

NOTE: The filter is run in a WordPress Loop, meaning functions such as get_the_post() ,get_the_ID()  and in_category()  can be used to filter out the posts that you want to target.

You can also use $feed_source = get_post_meta( get_the_ID(), 'wprss_feed_id', true );   to get the ID of the post’s feed source.

Example: the below filter gets the feed source of the post and checks if the feed source is assigned to the ‘music’ category, created by the Categories add-on. Note that ‘music’ is the slug name of the category.

The below is similar, but instead only links posts back to their original page, if their post type is ‘Job’:

If the post title links aren’t linking externally when on singular post view, apply this additional filter:

There are two methods to add the above code snippet to your site.

Please follow the instructions on our How to Add Actions and Filters page.