I have a theme which sets breadcrumbs like this:

function mytheme_process_node(&$variables) {

This gets overwritten later by something else. I need a specific taxonomy value of the displayed node to set the breadcrumb, that's why I am using this hook. How to do it effectively? Perhaps there is a hook which is performed later and still has access to the node object?

  • "a specific taxonomy value" - that is, a specific taxonomy term reference field?
    – donquixote
    Oct 7, 2013 at 15:14

2 Answers 2


I normally stick that logic in hook_preprocess_page(), it runs late enough in the page build to not be overwritten by anything else.

You can still get access to the node object by using the menu_get_object() function:

function MYTHEME_preprocess_page(&$vars) {
  if ($node = menu_get_object()) {
    // We're on a node page...

There is also hook_menu_breadcrumb_alter()

Besides, you can use one of the plenty of breadcrumb-customizing modules and might get what you want without custom code.

  • It is tempting to use this hook but you may end up with a correct breadcrumb and a wrong menu active trail.
    – Wtower
    Jan 22, 2015 at 18:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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