[wp-hackers] How to exntend wp_xmlrpc_server in plugin

Otto otto at ottodestruct.com
Thu Aug 2 18:55:08 UTC 2012


On Thu, Aug 2, 2012 at 1:05 PM, Martin Lazarov <martin at lazarov.bg> wrote:
> I'm doing something wrong, but don't now what...
>
> So is loaded after plugin is loaded:
> class-wp-xmlrpc-server.php is loaded in xmlrpc.php on line 55 and in
> my plugin i can't do
>
> class my_xmlrpc_class extends wp_xmlrpc_server ...
>
> Is it posible?

Yes. You need to hook to the wp_xmlrpc_server_class filter, define
your class at the time that filter runs, and then return the name of
the class.

add_filter('wp_xmlrpc_server_class','my_class');

function my_class($name) {

class my_xmlrpc_class extends wp_xmlrpc_server {
... class stuff here ...
}

return 'my_xmlrpc_class';
}

-Otto


More information about the wp-hackers mailing list