Skip to main content
1 of 3
Ram
  • 1.3k
  • 15
  • 37

In hook_node_insert drupal_goto with alias name not working

In hook_node_insert() i have used drupal_goto(), to go to the newly created node with alias name of it, but id doesn't work.

I have already created url alias with patterns for that content type.

$alias = drupal_get_path_alias($node->nid);
drupal_goto($alias);

If i give drupal_goto() with nid it works.

drupal_goto('node/'.$node->nid);

What is the issue with respect to alias name not working or how to get alias of newly created node and get it redirected to view page of it with alias name as url.

Any ideas or suggestions? Thanks in advance.

Ram
  • 1.3k
  • 15
  • 37