WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Why is $wp_xmlrpc_server->minimum_args protected? It seems like as much of a utility method as $wp_xmlrpc_server->login. Is there some other way to sanitize the inputs for length or do I have to write my own method?

share|improve this question

You can totally swap out the class that runs the xmlrpc server. So create a subclass of wp_xmlrpc_server, use it for the xmlrpc server class, and use all the protected methods you like.

Example (not tested, use with caution):

class WPSE69959_XMLRPC_Sever extends wp_xmlrpc_server
    // override the constructor to add your own methods.
    public function __construct()
        add_filter('xmlrpc_methods', array(__CLASS__, '_add_methods'));
        // call the parent constructor to set up the other methods

    public static function _add_methods($methods)
        $methods['say_hello_two'] = 'this:say_hello_two';
        return $methods;

    public function say_hello_two($args)
        // do stuff with protected methods here!

// swap out the classes
add_filter('wp_xmlrpc_server_class', 'wpse69959_swap_class');
function wpse69959_swap_class($cls)
    return 'WPSE69959_XMLRPC_Sever';

To answer your question, it's protected because it's meant to be an internal method. There would be no reason for someone outside the wp_xmlrpc_server class to use that method, so there's no reason for it to be public. Furthermore, the way it's implemented may cause unintentional side effects (like an error being set/sent) if it was used by an untrusted source -- eg. someone outside the wp_xmlrpc_server class.

share|improve this answer
Would swapping in my class prevent other plugins from working if they use this same code? Also, will this override the built-in Wordpress xmlrpc methods? – Zonedabone Oct 21 '12 at 3:21
Not if you create a subclass of wp_xmlrpc_server and make sure you call parent::__construct(); to set up everything. – chrisguitarguy Oct 21 '12 at 3:23

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.