Return webform in a node I have a custom filter added for a content type 'sample'. On selecting the custom filter for the node body, it checks for webform tokens like [webform:1234], by exploding it checks whether it is a webform or not. If it is a webform, it loads that node and render the same to the node body. Here is my code please have a check.

function landing_page_filter($text, $filter, $format, $langcode, $cache, $cache_id) {
  preg_match_all('/\\[([a-zA-z0-9_]+:[a-zA-z0-9_]+)+\\]/m', $text, $match);
  $matches = $match[0];
  foreach ($matches as $token) { dpm($token);
    $token_name = str_replace(array( '[', ']' ), '', $token);
    $type = explode(':', $token_name);
    if ($type[0] == 'webform') {
      $nid = $type[1]; 
      $node = node_load($nid);
     $form = drupal_render($node);
    }
  }
  return $form;
}
Rather than loading a page based on nid and then returning the loaded output as an HTML , use drupal_goto function like below :

drupal_goto('node'/.$nid);