Skip to Content


Check if the current visitor is a client by using their IP address or their WordPress user email domain (if they are logged in).

PHP April 27, 2017




(Optional) (Boolean) User must be logged in
Default: None

Parameter Notes

Passing $strict as true bypasses the IP address condition and requires the user to be logged in and a client.

Request or provide clarification »


<?php if ( is_client() ){
    //Something for clients only.
} ?>

Additional Notes

Developers and clients IP addresses and email domains can be added in Nebula Options under the Administration tab.

For clarification, “client” in this context means the person or business for whom this website is being made. Any stakeholder who is not a developer should be added as a client in Nebula Options.

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 232.

    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.

    Need a new filter hook? Request one here.

    This function has no action hooks available. Request one?

            public function is_client($strict=false){
                $override = apply_filters('pre_is_client', null, $strict);
                if ( isset($override) ){return $override;}
                if ( empty($strict) ){
                    $client_ips = ( !empty($this->get_option('client_ip')) )? $this->get_option('client_ip') : '';
                    $client_ips = explode(',', $client_ips);
                    if ( !empty($client_ips) ){
                        foreach ( $client_ips as $client_ip ){
                            $client_ip = wp_privacy_anonymize_ip(trim($client_ip));
                            if ( !empty($client_ip) && $client_ip[0] !== '/' && $client_ip === $this->get_ip_address() ){
                                return true;
                            if ( !empty($client_ip) && $client_ip[0] === '/' && preg_match($client_ip, $this->get_ip_address()) ){
                                return true;
                //Check if the current user's email domain matches any of the client email domains from Nebula Options
                if ( is_user_logged_in() ){
                    $current_user = wp_get_current_user();
                    if ( !empty($current_user->user_email) ){
                        $current_user_domain = explode('@', $current_user->user_email)[1];
                        $client_email_domains = ( $this->get_option('client_email_domain') )? $this->get_option('client_email_domain') : ''; //Ensure correct type
                        $client_email_domains = explode(',', $client_email_domains);
                        foreach ( $client_email_domains as $client_email_domain ){
                            if ( trim($client_email_domain) === $current_user_domain ){
                                return true;
                return false;


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

    add_filter('pre_is_client', 'my_custom_is_client', 10, 2); //The last integer must be 1 more than the actual parameters
    function my_custom_is_client($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:

     add_filter('pre_is_client', '__return_false');