#21: xmlrpc_default_taxonomy_fields

The xmlrpc_default_taxonomy_fields XML-RPC filter allows you to modify the default array of taxonomy fields to be retrieve with various methods.

It is evaluated in the wp.getTaxonomy() and wp.getTaxonomies() XML-RPC methods in the wp-includes/class-wp-xmlrpc-server.php file.

xmlrpc_default_taxonomy_fields accepts 2 arguments:

  1. array An array of taxonomy fields to retrieve, defaults to labels, cap, and object_type
  2. string wp.getTaxonomy|getTaxonomies The method name with wp namespace


Let’s say you’re using the wp.getTaxonomy() or wp.getTaxonomies() method to retrieve taxonomy data for an XML-RPC project. And let’s say for some reason you won’t need to retrieve a taxonomy’s label data — maybe it’s for private use only or something. The following limits the taxonomy fields retrieved to cap, and object_type.

View the code example on Gist.