wp_xmlrpc_server::wp_getTaxonomy( array $args )

Retrieve a taxonomy.


Description

See also


Parameters

$args

(Required) Method arguments. Note: arguments must be ordered as documented.

  • 'blog_id'
    (int) Blog ID (unused).
  • 'username'
    (string) Username.
  • 'password'
    (string) Password.
  • 'taxnomy'
    (string) Taxonomy name.
  • 'fields'
    (array) Optional. Array of taxonomy fields to limit to in the return. Accepts 'labels', 'cap', 'menu', and 'object_type'. Default empty array.


Return

(array|IXR_Error) An array of taxonomy data on success, IXR_Error instance otherwise.


Source

File: wp-includes/class-wp-xmlrpc-server.php

	public function wp_getTaxonomy( $args ) {
		if ( ! $this->minimum_args( $args, 4 ) )
			return $this->error;

		$this->escape( $args );

		$username = $args[1];
		$password = $args[2];
		$taxonomy = $args[3];

		if ( isset( $args[4] ) ) {
			$fields = $args[4];
		} else {
			/**
			 * Filters the taxonomy query fields used by the given XML-RPC method.
			 *
			 * @since WP-3.4.0
			 *
			 * @param array  $fields An array of taxonomy fields to retrieve.
			 * @param string $method The method name.
			 */
			$fields = apply_filters( 'xmlrpc_default_taxonomy_fields', array( 'labels', 'cap', 'object_type' ), 'wp.getTaxonomy' );
		}

		if ( ! $user = $this->login( $username, $password ) )
			return $this->error;

		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
		do_action( 'xmlrpc_call', 'wp.getTaxonomy' );

		if ( ! taxonomy_exists( $taxonomy ) )
			return new IXR_Error( 403, __( 'Invalid taxonomy.' ) );

		$taxonomy = get_taxonomy( $taxonomy );

		if ( ! current_user_can( $taxonomy->cap->assign_terms ) )
			return new IXR_Error( 401, __( 'Sorry, you are not allowed to assign terms in this taxonomy.' ) );

		return $this->_prepare_taxonomy( $taxonomy, $fields );
	}


Changelog

Changelog
Version Description
WP-3.4.0 Introduced.