How to Integrate Drupal Feed into WordPress Application on LinkedIn

In this article I will show how I have integrated Drupal feed from into WordPress application on LinkedIn.

When I first tried to add GerixSoft's feed into WordPress application, it refused saying "Only WordPress feeds are supported". After comparing Drupal and WordPress feeds, I have figured out they are using the same RSS standard. The only difference is meta "generator" element, absent on Drupal but present on WordPress XML.

Wild guess have confirmed that WordPress is using this string to block RSS from non-WordPress platforms.

To fix this, open includes/, locate format_rss_channel function and apply the following patch:

 * Formats an RSS channel.
 * Arbitrary elements may be added using the $args associative array.
function format_rss_channel($title, $link, $description, $items, $langcode = NULL, $args = array()) {
  global $language;
  $langcode = $langcode ? $langcode : $language->language;

  $output = "<channel>\n";
  $output .= ' <title>'. check_plain($title) ."</title>\n";
  $output .= ' <link>'. check_url($link) ."</link>\n";

  // The RSS 2.0 "spec" doesn't indicate HTML can be used in the description.
  // We strip all HTML tags, but need to prevent double encoding from properly
  // escaped source data (such as &amp becoming &amp;amp;).
  $output .= ' <description>'. check_plain(decode_entities(strip_tags($description))) ."</description>\n";
  // © by Andriy Gerasika from GerixSoft, Ltd.
  $output .= "<generator></generator>\n";

  $output .= ' <language>'. check_plain($langcode) ."</language>\n";
  $output .= format_xml_elements($args);
  $output .= $items;
  $output .= "</channel>\n";

  return $output;

Note, when you'll be resubmitting feed into WordPress application, it still might say feed is not from WordPress – just try several times and it will accept the feed ultimately (seems there is some sort of cache on the server).


Post new comment

The content of this field is kept private and will not be shown publicly.