Skip to Content
Menu

is_debug()

If the debug query string is being used.

PHP April 27, 2017

Usage

PHP
nebula()->is_debug($strict)

Parameters

$strict
(Optional) (Integer) How strict to limit debug checks
Default: false

Parameter Notes

Strict as 0 or false allows any visitor to use the query string.

Strict as 1 or true requires the user to be a developer or client.

Strict as 2 requires the user to be a developer or client and be logged in to WordPress.

Request or provide clarification »

Was this page helpful? Yes No


    A feedback message is required to submit this form.


    Please check that you have entered a valid email address.

    Enter your email address if you would like a response.

    Thank you for your feedback!

    Source File

    Located in /libs/Utilities/Utilities.php on line 310.

    1 Hook

    Find these filters and actions in the source code below to hook into them. Use do_action() and add_filter() in your functions file or plugin.

    Filters
    "pre_is_debug"
    Need a new filter hook? Request one here.

    Actions
    This function has no action hooks available. Request one?

    PHP
            public function is_debug($strict=false){
                $override = apply_filters('pre_is_debug', null, $strict);
                if ( isset($override) ){return $override;}
    
                $very_strict = ( $strict > 1 )? $strict : false;
                if ( array_key_exists('debug', $this->super->get) ){
                    if ( !empty($strict) ){
                        if ( $this->is_dev($very_strict) || $this->is_client($very_strict) ){
                            return true;
                        }
                        return false;
                    }
                    return true;
                }
                return false;
            }
    

    Override

    To override this PHP function, use this hook in your child theme or plugin ("my_custom" can be changed):

    PHP
    add_filter('pre_is_debug', 'my_custom_is_debug', 10, 2); //The last integer must be 1 more than the actual parameters
    function my_custom_is_debug($null, $strict){ //$null is required, but can be ignored
        //Write your own code here
    
        return true; //Return true to prevent the original function from running afterwords
    }

    You can completely disable this PHP function with a single line actions:

    PHP
     add_filter('pre_is_debug', '__return_false');