How to unregister all page handler ?

I'm writing a plugin to support mobile/tablet. For some reasons, my system don't need lots of default features, so I want to unregister all default page handlers and completely rewrite all.

Is there anyway to do that ?

Thank you so much for helping :)

  • Register a handler for the route, all hook and return false to prevent any page handler from being called. You will have to do your own page handling in the handler function.

  • Can you give me some sample code ? Thank you so much !

    Now, this is my code



    // start.php

    elgg_register_event_handler('init', 'system', 'coming_soon_init');

    function coming_soon_init() {
        elgg_register_page_handler('what_is_here ???', 'coming_soon_page_handler');
        elgg_register_plugin_hook_handler('index', 'system', 'coming_soon_index', 1);


    function coming_soon_index() {
        $body = elgg_view_layout('coming_soon');
        echo elgg_view_page('', $body, 'coming_soon');
        return true;

    function coming_soon_page_handler($page) {
        return false;

  • elgg_register_plugin_hook_handler('route', 'all', 'remove_pg_handlers');   
    function remove_pg_handlers($hook, $type, $return, $params) {
        return false;

    Now if you want to remove specific page handlers use elgg_unregister_pagehandler()

  • Great! It worked perfectly! Thank you :)

    And now I also want to remove default css and js. I used


    It worked but the vendor jquery 1.6.4 is still used. I want to replace it by jquery 1.7.2 or another js library such as mootools, dojo. So how to do it ?

    Thank you :)

  • Use elgg_register_js(). I recommend always reading the inline documentation for functions because it usually points you to related functions. Also, look at the bundled plugins for examples of many of these things.