{"id":5590,"date":"2014-04-02T08:21:41","date_gmt":"2014-04-02T08:21:41","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/04\/02\/fatal-error-when-calling-drupal_goto-from-hook_boot-collection-of-common-programming-errors\/"},"modified":"2014-04-02T08:21:41","modified_gmt":"2014-04-02T08:21:41","slug":"fatal-error-when-calling-drupal_goto-from-hook_boot-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/04\/02\/fatal-error-when-calling-drupal_goto-from-hook_boot-collection-of-common-programming-errors\/","title":{"rendered":"Fatal error when calling drupal_goto from hook_boot-Collection of common programming errors"},"content":{"rendered":"<p>When I am trying to call drupal_goto from hook_boot I get an error:<\/p>\n<blockquote>\n<p>Fatal error: Call to undefined function drupal_goto()<\/p>\n<\/blockquote>\n<p>What am I doing wrong and why is that happening?<\/p>\n<p>My code:<\/p>\n<pre><code>function custom_mobile_redirect_boot() {\n  include_once 'Mobile_Detect.php';\n  $detect = new Mobile_Detect();\n  if ($detect-&gt;isMobile() || $detect-&gt;isTablet()) {\n    drupal_goto('http:\/\/testsite.local');\n  }\n}\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>When I am trying to call drupal_goto from hook_boot I get an error: Fatal error: Call to undefined function drupal_goto() What am I doing wrong and why is that happening? My code: function custom_mobile_redirect_boot() { include_once &#8216;Mobile_Detect.php&#8217;; $detect = new Mobile_Detect(); if ($detect-&gt;isMobile() || $detect-&gt;isTablet()) { drupal_goto(&#8216;http:\/\/testsite.local&#8217;); } }<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-5590","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/5590","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=5590"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/5590\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=5590"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=5590"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=5590"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}