Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8366615
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:57:30+00:00 2026-06-09T12:57:30+00:00

I have a loader function which is called excessively whenever the user accesses the

  • 0

I have a loader function which is called excessively whenever the user accesses the page. Naturally, I only need it to run once per page request, instead, it is called multiple times. Earlier the _load() ran only twice with MENU_CALLBACK, then I tested it with the default MENU_NORMAL_ITEM and it increased to four. Although I’ve changed it back, and cleared my cache, it still runs four times now, and I only want it to run once.

My question is, why is my loader function being called multiple times? Any insight would be greatly appreciated.

$items['daycare/%isValid/home'] = array(
    'title' => 'Daycare Admin Home',
    'page callback' => 'daycares_home_page',
    'load arguments' => array(0),//Passes 1st part of url 'daycare' as 2nd arg
    'page arguments' => array(0),
    'access arguments' => array('access content'),
    'type' => MENU_CALLBACK,
);

function isValid_load($pageID, $pageType){
    /*Do stuff to validate wildcard part of URL. Will throw 404/403 if invalid*/
    return $pageId;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T12:57:31+00:00Added an answer on June 9, 2026 at 12:57 pm

    You can use devel‘s ddebug_backtrace() function to see how/what is calling your load function.

    function isValid_load($pageID, $pageType){
        ddebug_backtrace();
        ...
    }
    

    When you do, notice that the two calls can be traced back to the last two lines in index.php. The first bootstraps Drupal and initializes the theme while the second call actually does the work of rendering the page. Though both actions seem to call the same _menu_translate() which results in a call to your function.

    As a side note, if you’re concerned about performance, you might be interested in this Lullabot article about caching.

    I realize that this is a partial answer as I’m still getting familiar with the deepest workings of Drupal myself. I welcome competing answers that can provide a clearer and more complete explanation of why the Drupal framework is structured in such a way that the _load function is called multiple times.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a function below which is called to reload a recaptcha image. It
I have this script loaded on a page: (function() { window.alert('bookmarklet started'); function AjaxSuccess(data,
I have a context loader class which loads an XML file with info on
I have a custom class loader which extends from a URLClassLoader. I added a
Hi have a page which has List data. When I click on an element
I have a function which hides or shows elements with a given class name:
On my page, i have a button, which on clicked, refreshes a jstree found
I have a variable () loaded with a html code: $.get(url, function (res, data)
How can I check whether all JavaScript functions have loaded properly on a page?
I have a loader div defined as say for simplicity <div dojoAttachpoint=loaderDiv style=display:none;>.....</div> Now

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.