I need to create an XML using Views RSS module, and it's created correctly. But I want to add a custom field to the XML. For example, an item from the XML is:

<title>Liburu bat</title>
 <description>Produktu bat</description>
 <category>Forros para botas %% Espuelas %% Calzado</category>
 <guid isPermaLink="false">1022</guid>
 <source url="http://whatever.com/es/comercios/productos/whatever.xml">Escaparate Whatever</source>

And I want to add a custom field to that item, for example: Something else

Any idea how can I do it?


You need to implement a hook_views_rss_item_elements() invocation if you're wanting to add a custom item element. For example:

 * Implements hook_views_rss_item_elements().
function MYMODULE_views_rss_item_elements() {
  $elements['my_element'] = array(
    'title' => t('My Element'),
    'description' => t('Provides a my_element to an item element in Views RSS.'),
  return $elements;
  • How would I do this in Drupal 8?? I tried using this same hook but it doesn't produce the custom node. I tried to search for the hook in Drupal 8 documentation but I couldn't find it. Thanx
    – chavab_1
    Nov 15 '16 at 0:26
  • Your feed format should be set to 'RSS Feed - Fields' not 'RSS Feed' if you want these hooks to be fired.
    – Gervase
    Nov 7 '18 at 20:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.