Title: IXR_Server::call
Published: July 6, 2022
Last modified: May 20, 2026

---

# IXR_Server::call( $methodname,  $args )

## In this article

 * [Source](https://developer.wordpress.org/reference/classes/ixr_server/call/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/ixr_server/call/?output_format=md#related)

[ Back to top](https://developer.wordpress.org/reference/classes/ixr_server/call/?output_format=md#wp--skip-link--target)

## 󠀁[Source](https://developer.wordpress.org/reference/classes/ixr_server/call/?output_format=md#source)󠁿

    ```php
    function call($methodname, $args)
    {
        if (!$this->hasMethod($methodname)) {
            return new IXR_Error(-32601, 'server error. requested method '.$methodname.' does not exist.');
        }
        $method = $this->callbacks[$methodname];

        // Perform the callback and send the response
        if (count($args) == 1) {
            // If only one parameter just send that instead of the whole array
            $args = $args[0];
        }

        // Are we dealing with a function or a method?
        if (is_string($method) && substr($method, 0, 5) == 'this:') {
            // It's a class method - check it exists
            $method = substr($method, 5);
            if (!method_exists($this, $method)) {
                return new IXR_Error(-32601, 'server error. requested class method "'.$method.'" does not exist.');
            }

            //Call the method
            $result = $this->$method($args);
        } else {
            // It's a function - does it exist?
            if (is_array($method)) {
                if (!is_callable(array($method[0], $method[1]))) {
                    return new IXR_Error(-32601, 'server error. requested object method "'.$method[1].'" does not exist.');
                }
            } else if (!function_exists($method)) {
                return new IXR_Error(-32601, 'server error. requested function "'.$method.'" does not exist.');
            }

            // Call the function
            $result = call_user_func($method, $args);
        }
        return $result;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/ixr/class-ixr-server.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/IXR/class-IXR-server.php#L87)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/IXR/class-IXR-server.php#L87-L124)

## 󠀁[Related](https://developer.wordpress.org/reference/classes/ixr_server/call/?output_format=md#related)󠁿

| Uses | Description | 
| [IXR_Server::hasMethod()](https://developer.wordpress.org/reference/classes/ixr_server/hasmethod/)`wp-includes/IXR/class-IXR-server.php` |  | 
| [IXR_Error::__construct()](https://developer.wordpress.org/reference/classes/ixr_error/__construct/)`wp-includes/IXR/class-IXR-error.php` |

PHP5 constructor.

  |

| Used by | Description | 
| [IXR_IntrospectionServer::call()](https://developer.wordpress.org/reference/classes/ixr_introspectionserver/call/)`wp-includes/IXR/class-IXR-introspectionserver.php` |  | 
| [IXR_Server::multiCall()](https://developer.wordpress.org/reference/classes/ixr_server/multicall/)`wp-includes/IXR/class-IXR-server.php` |  | 
| [IXR_Server::serve()](https://developer.wordpress.org/reference/classes/ixr_server/serve/)`wp-includes/IXR/class-IXR-server.php` |  |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fixr_server%2Fcall%2F)
before being able to contribute a note or feedback.