CodeIgniter 4 hide the Debug Toolbar for certain routes

To hide the debug toolbar for a certain route, edit Config/Filters.php and add  a new constructor at the bottom of the file containing the following

public function __construct()
    if (isset($_SERVER['REQUEST_URI']) && strpos($_SERVER['REQUEST_URI'], 'your_URL_here')) unset($this->globals['after'][0]);

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.