How to customize the Item URL in Feedzy?
📝 Note: This feature is available when importing feeds as posts. If you want to learn more about this, check this doc.
This article presents a filter that allows you to customize the [#item_url] tag that is available when importing feeds as posts in the content area. You can adjust the UTM source, medium, and campaign, as well as the link opening behavior and link type.
- 1
-
Copy this code snippet.
add_filter( 'feedzy_item_link', function ( $item_link_data, $item, $job ) { // Change link text. $item_link_data['text'] = 'LINK TEXT HERE'; // Add tracking parameters/UTMs. $item_link_data['attr']['href'] = add_query_arg( array( 'utm_source' => '', 'utm_medium' => '', 'utm_campaign' => '', ), $item_link_data['attr']['href'] ); // Change link opening behavior. $item_link_data['attr']['target'] = '_self'; // _blank, _self, _parent, _top // Add link type - follow/nofollow link. $item_link_data['attr']['rel'] = 'nofollow'; // noopener, nofollow. return $item_link_data; }, 10, 3 );
- 2
-
Paste it into the currently active theme functions.php file.
📝Note: If you paste the code snippet into the plugin's source file, the changes will be lost when you update the plugin. The same thing may happen when you update the theme, this is why we recommend using a child theme.
- 3
-
Save the changes and recreate the scenario to see how it works.
💡Result