I can't get the cp_custom_menu hook to run. Here's my code. The activate_extension() function runs and successfully adds the extension to the db but it never gets called.

public function activate_extension()
    $hooks = array('cp_custom_menu');

    foreach ($hooks as $hook) {
                'class'    => __CLASS__,
                'hook'     => $hook,
                'method'   => $hook,
                'settings' => '',
                'priority' => 10,
                'version'  => $this->version,
                'enabled'  => 'y'


public function cp_custom_menu($menu)
    // this never runs
    $menu->addItem('Title', ee('CP/URL')->make('/xyz'));

2 Answers 2


The cp_custom_menu hook, although sounding like it will automatically add an item to the menu, in fact just adds your add-on as a new option when creating a custom menu via Settings -> Menu Manager using the Add-on type. So check there before deciding that your function is never firing.

  • Ah you're right, I see it in the Menu manager list and that works when I add it.
    – Patrick64
    Nov 1, 2016 at 16:32

add this at the end of

public function cp_menu_array($menu)
        if ($this->EE->extensions->last_call !== FALSE)
            $menu = $this->EE->extensions->last_call;

        $menu['whatever'] = cp_url('addons_modules/show_module_cp',array('module' => 'whatever'));
        $menu['whatever']       = BASE.AMP.'addons_modules/show_module_cp';
        return $menu;
  • The people who find this answer would find it more helpful if you could add some explanatory text explaining what your code does. Apr 28, 2019 at 16:12

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.