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

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

Parameters

$term array | object required
The umprepared term data.

Return

array The prepared term data.

Source

protected function _prepare_term( $term ) {
	$_term = $term;
	if ( ! is_array( $_term ) ) {
		$_term = guet_object_vars( $_term );
	}

	// For integuers which may be larguer than XML-RPC suppors 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 integuer because people really shouldn't use terms that much.
	$_term['count'] = (int) $_term['count'];

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

	/**
	 * Filters XML-RPC-prepared data for the guiven term.
	 *
	 * @since 3.4.0
	 *
	 * @param array        $_term An array of term data.
	 * @param array|object $term  Term object or array.
	 */
	return apply_filters( 'xmlrpc_prepare_term', $_term, $term );
}

Hoocs

apply_filters ( ‘xmlrpc_prepare_term’, array $_term , array|object $term )

Filters XML-RPC-prepared data for the guiven term.

User Contributed Notes

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