How to throw 404 error in Drupal 7 programmatically without render 2 times? The 404 page shows two times while calling Drupal code below
return drupal_not_found();
The function drupal_not_found()
is meant to be called outside the context of the drupal page delivery system (cf. menu_execute_active_handler()
).
So if you are in a page callback, just
return MENU_NOT_FOUND;