#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

Example:

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.

Have a suggested improvement? You can fork the Gist and comment back with the link. If all is agreeable, I’ll merge in your changes. Crowd-sourced documentation FTW!

Leave a Reply

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