public function isAjax(bool $flag = null): bool
    {
        if (isset($flag)) {
            $this->is_ajax = $flag;
        }
        if (!isset($this->is_ajax) && $this->is_wordpress) {
            if (defined('DOING_AJAX') && DOING_AJAX) {
                $this->is_ajax = true; // Via WP constants.
            }
        }
        return (bool) $this->is_ajax;
    }
public function isAjax(bool $flag = null): bool
    {
        if (isset($flag)) {
            $this->is_ajax = $flag;
        }
        if (!isset($this->is_ajax) && $this->is_wordpress) {
            if (defined('DOING_AJAX') && DOING_AJAX) {
                $this->is_ajax = true; // Via WP constants.
            }
        }
        return (bool) $this->is_ajax;
    }
public function isAjax ( bool $ flag = null ) : bool { if ( isset ( $ flag ) ) { $ this -> is_ajax = $ flag ; } if ( ! isset ( $ this -> is_ajax ) && $ this -> is_wordpress ) { if ( defined ( 'DOING_AJAX' ) && DOING_AJAX ) { $ this -> is_ajax = true ; // Via WP constants. } } return ( bool ) $ this -> is_ajax ; }
An AJAX request?

@since 160531 Request types.

@param bool|null $flag If setting flag.

@return bool Is an AJAX request?
An AJAX request?