[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

/src/bp-forums/bbpress/bb-includes/ -> class.bb-taxonomy.php (summary)

(no description)

File Size: 329 lines (13 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

BB_Taxonomy:: (4 methods):
  get_objects_in_term()
  delete_object_term_relationships()
  get_object_terms()
  set_object_terms()


Class: BB_Taxonomy  - X-Ref

Taxonomy API

get_objects_in_term( $terms, $taxonomies, $args = null )   X-Ref
Retrieve object_ids of valid taxonomy and term.

The strings of $taxonomies must exist before this function will continue. On
failure of finding a valid taxonomy, it will return an WP_Error class, kind
of like Exceptions in PHP 5, except you can't catch them. Even so, you can
still test for the WP_Error class and get the error message.

The $terms aren't checked the same as $taxonomies, but still need to exist
for $object_ids to be returned.

It is possible to change the order that object_ids is returned by either
using PHP sort family functions or using the database by using $args with
either ASC or DESC array. The value should be in the key named 'order'.

param: string|array $terms String of term or array of string values of terms that will be used
param: string|array $taxonomies String of taxonomy name or Array of string values of taxonomy names
param: array|string $args Change the order of the object_ids, either ASC or DESC
return: WP_Error|array If the taxonomy does not exist, then WP_Error will be returned. On success
since: 1.0

delete_object_term_relationships( $object_id, $taxonomies, $user_id = 0 )   X-Ref
Will unlink the term from the taxonomy.

Will remove the term's relationship to the taxonomy, not the term or taxonomy
itself. The term and taxonomy will still exist. Will require the term's
object ID to perform the operation.

param: int $object_id The term Object Id that refers to the term
param: string|array $taxonomy List of Taxonomy Names or single Taxonomy name.
param: int $user_id The ID of the user who created the relationship.
since: 1.0

get_object_terms($object_ids, $taxonomies, $args = array()   X-Ref
Retrieves the terms associated with the given object(s), in the supplied taxonomies.

The following information has to do the $args parameter and for what can be
contained in the string or array of that parameter, if it exists.

The first argument is called, 'orderby' and has the default value of 'name'.
The other value that is supported is 'count'.

The second argument is called, 'order' and has the default value of 'ASC'.
The only other value that will be acceptable is 'DESC'.

The final argument supported is called, 'fields' and has the default value of
'all'. There are multiple other options that can be used instead. Supported
values are as follows: 'all', 'ids', 'names', and finally
'all_with_object_id'.

The fields argument also decides what will be returned. If 'all' or
'all_with_object_id' is choosen or the default kept intact, then all matching
terms objects will be returned. If either 'ids' or 'names' is used, then an
array of all matching term ids or term names will be returned respectively.

param: int|array $object_id The id of the object(s) to retrieve.
param: string|array $taxonomies The taxonomies to retrieve terms from.
param: array|string $args Change what is returned
return: array|WP_Error The requested term data or empty array if no terms found. WP_Error if $taxonomy does not exist.
since: 1.0

set_object_terms($object_id, $terms, $taxonomy, $args = null)   X-Ref
Create Term and Taxonomy Relationships.

Relates an object (post, link etc) to a term and taxonomy type. Creates the
term and taxonomy relationship if it doesn't already exist. Creates a term if
it doesn't exist (using the slug).

A relationship means that the term is grouped in or belongs to the taxonomy.
A term has no meaning until it is given context by defining which taxonomy it
exists under.

param: int $object_id The object to relate to.
param: array|int|string $term The slug or id of the term, will replace all existing
param: array|string $taxonomy The context in which to relate the term to the object.
param: bool $append If false will delete difference of terms.
return: array|WP_Error Affected Term IDs
since: 1.0



Generated: Thu Dec 7 01:01:35 2017 Cross-referenced by PHPXref 0.7.1