wp_xmlrpc_server::_prepare_taxonomy() WordPress Method
The wp_xmlrpc_server::_prepare_taxonomy() method is used to prepare a taxonomy for use in the XML-RPC server. This method is called by the wp_xmlrpc_server::wp_getTaxonomies() method.
wp_xmlrpc_server::_prepare_taxonomy( WP_Taxonomy $taxonomy, array $fields ) #
Prepares taxonomy data for return in an XML-RPC object.
Parameters
- $taxonomy
(WP_Taxonomy)(Required)The unprepared taxonomy data.
- $fields
(array)(Required)The subset of taxonomy fields to return.
Return
(array) The prepared taxonomy data.
Source
File: wp-includes/class-wp-xmlrpc-server.php
protected function _prepare_taxonomy( $taxonomy, $fields ) { $_taxonomy = array( 'name' => $taxonomy->name, 'label' => $taxonomy->label, 'hierarchical' => (bool) $taxonomy->hierarchical, 'public' => (bool) $taxonomy->public, 'show_ui' => (bool) $taxonomy->show_ui, '_builtin' => (bool) $taxonomy->_builtin, ); if ( in_array( 'labels', $fields, true ) ) { $_taxonomy['labels'] = (array) $taxonomy->labels; } if ( in_array( 'cap', $fields, true ) ) { $_taxonomy['cap'] = (array) $taxonomy->cap; } if ( in_array( 'menu', $fields, true ) ) { $_taxonomy['show_in_menu'] = (bool) $taxonomy->show_in_menu; } if ( in_array( 'object_type', $fields, true ) ) { $_taxonomy['object_type'] = array_unique( (array) $taxonomy->object_type ); } /** * Filters XML-RPC-prepared data for the given taxonomy. * * @since 3.4.0 * * @param array $_taxonomy An array of taxonomy data. * @param WP_Taxonomy $taxonomy Taxonomy object. * @param array $fields The subset of taxonomy fields to return. */ return apply_filters( 'xmlrpc_prepare_taxonomy', $_taxonomy, $taxonomy, $fields ); }
Expand full source codeCollapse full source codeView on TracView on GitHub