How to determine which xmlrpc method is being called in WordPress

June 3, 2014

While working on a plugin to monitor incoming interactions with the xmlrpc in WordPress I had the need to discover which xmlrpc method was being called. Turns out this is not a simple as it seems it should be. WordPress uses what I gather is an older external library that does not contain any hooks for xmlrpc. In order to determine which xmlrpc method is being called you will need to duplicate code from the WordPress core in your own plugin.

Here is that code:

function current_xmlrpc_method() {
        require_once( ABSPATH . WPINC . '/class-IXR.php' );  
        global $HTTP_RAW_POST_DATA;
        $ixr_message = new IXR_Message( $HTTP_RAW_POST_DATA );
        $ixr_message->parse();
        return $ixr_message->methodName;
}
Leave a Reply

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