Retrieves all taxonomies.
Description
See also
Parameters
$args
arrayrequired- Method arguments. Note: arguments must be ordered as documented.
0
intBlog ID (unused).1
stringUsername.2
stringPassword.3
arrayOptional. An array of arguments for retrieving taxonomies.4
arrayOptional. The subset of taxonomy fields to return.
Source
public function wp_getTaxonomies( $args ) {
if ( ! $this->minimum_args( $args, 3 ) ) {
return $this->error;
}
$this->escape( $args );
$username = $args[1];
$password = $args[2];
$filter = isset( $args[3] ) ? $args[3] : array( 'public' => true );
if ( isset( $args[4] ) ) {
$fields = $args[4];
} else {
/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
$fields = apply_filters( 'xmlrpc_default_taxonomy_fields', array( 'labels', 'cap', 'object_type' ), 'wp.getTaxonomies' );
}
$user = $this->login( $username, $password );
if ( ! $user ) {
return $this->error;
}
/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
do_action( 'xmlrpc_call', 'wp.getTaxonomies', $args, $this );
$taxonomies = get_taxonomies( $filter, 'objects' );
// Holds all the taxonomy data.
$struct = array();
foreach ( $taxonomies as $taxonomy ) {
// Capability check for post types.
if ( ! current_user_can( $taxonomy->cap->assign_terms ) ) {
continue;
}
$struct[] = $this->_prepare_taxonomy( $taxonomy, $fields );
}
return $struct;
}
Hooks
- do_action( ‘xmlrpc_call’,
string $name ,array|string $args ,wp_xmlrpc_server $server ) Fires after the XML-RPC user has been authenticated but before the rest of the method logic begins.
- apply_filters( ‘xmlrpc_default_taxonomy_fields’,
array $fields ,string $method ) Filters the default taxonomy query fields used by the given XML-RPC method.
Changelog
Version | Description |
---|---|
3.4.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.