wp_xmlrpc_server::_prepare_term( array|object $term ): array

In this article

Prepares term data for return in an XML-RPC object.

Parameters

$termarray|objectrequired
The unprepared term data.

Return

array The prepared term data.

Source

	 * @param array       $fields    The subset of taxonomy fields to return.
	 */
	return apply_filters( 'xmlrpc_prepare_taxonomy', $_taxonomy, $taxonomy, $fields );
}

/**
 * Prepares term data for return in an XML-RPC object.
 *
 * @param array|object $term The unprepared term data.
 * @return array The prepared term data.
 */
protected function _prepare_term( $term ) {
	$_term = $term;
	if ( ! is_array( $_term ) ) {
		$_term = get_object_vars( $_term );
	}

	// For integers which may be larger than XML-RPC supports ensure we return strings.
	$_term['term_id']          = (string) $_term['term_id'];
	$_term['term_group']       = (string) $_term['term_group'];
	$_term['term_taxonomy_id'] = (string) $_term['term_taxonomy_id'];
	$_term['parent']           = (string) $_term['parent'];

	// Count we are happy to return as an integer because people really shouldn't use terms that much.
	$_term['count'] = (int) $_term['count'];

	// Get term meta.
	$_term['custom_fields'] = $this->get_term_custom_fields( $_term['term_id'] );

User Contributed Notes

You must log in before being able to contribute a note or feedback.