How to redirect my content type form after submitting in module.


function message_proposal_form_alter( & $form, & $form_state, $form_id) {
  if ($form['#id'] == "article-node-form") {
    $form['submit'][] = 'my_callback_function';



function my_callback_function($form, $form_state) {
  $form_state['redirect'] = 'node/add/article';
  • You tried and?.. What was the effect? "is not redirected" is pretty vague. Is function called at all? Some kind of PHP error happens? HTTP 500? Any redirection http headers sent or not?
    – Mołot
    Commented Aug 4, 2015 at 10:57

1 Answer 1


You can use Node Save Redirect module.

This module provides a method of specifying a location to take the user after saving a piece of content. A set of radios buttons are added to the submission vertical tab on the content type edit form.

The available options are:

Default - Default behaviour

Return to Edit page after saving

Return to content overview page (assuming the user has access permissions

Re-redirect to another location. (any valid drupal path)

Or you may try to add submit function to 'Save' button

function mymodule_form_alter (&$form, &$form_state, $form_id) {
  if ($form_id == 'my_node_form_id') {
    $form['actions']['submit']['#submit'][] = 'mymodule_node_form_redirect_submit';

function mymodule_node_form_redirect_submit ($form, &$form_state) {
  $form_state['redirect'] = 'node/add/article';
  • Thank you. But I would like to do using custom module.
    – kalidossan
    Commented Aug 4, 2015 at 11:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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