PHP Cross Reference of WordPress Subversion HEAD |
| [ Index ] [ Classes ] [ Functions ] [ Variables ] [ Constants ] |
[Source view] [Print]
(no description)
| File Size: | 1717 lines (54 kb) |
| Included or required: | 0 times |
| Referenced: | 0 times |
| Includes or requires: | 0 files |
| get_object_taxonomies($object_type) X-Ref |
| get_object_taxonomies() - Return all of the taxonomy names that are of $object_type It appears that this function can be used to find all of the names inside of $wp_taxonomies global variable. <code><?php $taxonomies = get_object_taxonomies('post'); ?></code> Should result in <code>Array('category', 'post_tag')</code> param: string $object_type Name of the type of taxonomy object return: array The names of all taxonomy of $object_type. |
| get_taxonomy( $taxonomy ) X-Ref |
| get_taxonomy() - Returns the taxonomy object of $taxonomy. The get_taxonomy function will first check that the parameter string given is a taxonomy object and if it is, it will return it. param: string $taxonomy Name of taxonomy object to return return: object|bool The Taxonomy Object or false if $taxonomy doesn't exist |
| is_taxonomy( $taxonomy ) X-Ref |
| is_taxonomy() - Checks that the taxonomy name exists param: string $taxonomy Name of taxonomy object return: bool Whether the taxonomy exists or not. |
| is_taxonomy_hierarchical($taxonomy) X-Ref |
| is_taxonomy_hierarchical() - Whether the taxonomy object is hierarchical Checks to make sure that the taxonomy is an object first. Then Gets the object, and finally returns the hierarchical value in the object. A false return value might also mean that the taxonomy does not exist. param: string $taxonomy Name of taxonomy object return: bool Whether the taxonomy is hierarchical |
| register_taxonomy( $taxonomy, $object_type, $args = array() X-Ref |
| register_taxonomy() - Create or modify a taxonomy object. A simple function for creating or modifying a taxonomy object based on the parameters given. The function will accept an array (third optional parameter), along with strings for the taxonomy name and another string for the object type. The function keeps a default set, allowing for the $args to be optional but allow the other functions to still work. It is possible to overwrite the default set, which contains two keys: hierarchical and update_count_callback. Nothing is returned, so expect error maybe or use is_taxonomy() to check whether taxonomy exists. Optional $args contents: hierarachical - has some defined purpose at other parts of the API and is a boolean value. update_count_callback - works much like a hook, in that it will be called when the count is updated. param: string $taxonomy Name of taxonomy object param: string $object_type Name of the object type for the taxonomy object. param: array|string $args See above description for the two keys values. |
| get_objects_in_term( $terms, $taxonomies, $args = array() X-Ref |
| get_objects_in_term() - Return 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 |
| get_term($term, $taxonomy, $output = OBJECT, $filter = 'raw') X-Ref |
| get_term() - Get all Term data from database by Term ID. The usage of the get_term function is to apply filters to a term object. It is possible to get a term object from the database before applying the filters. $term ID must be part of $taxonomy, to get from the database. Failure, might be able to be captured by the hooks. Failure would be the same value as $wpdb returns for the get_row method. There are two hooks, one is specifically for each term, named 'get_term', and the second is for the taxonomy name, 'term_$taxonomy'. Both hooks gets the term object, and the taxonomy name as parameters. Both hooks are expected to return a Term object. 'get_term' hook - Takes two parameters the term Object and the taxonomy name. Must return term object. Used in @see get_term() as a catch-all filter for every $term. 'get_$taxonomy' hook - Takes two parameters the term Object and the taxonomy name. Must return term object. $taxonomy will be the taxonomy name, so for example, if 'category', it would be 'get_category' as the filter name. Useful for custom taxonomies or plugging into default taxonomies. param: int|object $term If integer, will get from database. If object will apply filters and return $term. param: string $taxonomy Taxonomy name that $term is part of. param: string $output Constant OBJECT, ARRAY_A, or ARRAY_N param: string $filter {@internal Missing Description}} return: mixed|null|WP_Error Term Row from database. Will return null if $term is empty. If taxonomy does not |
| get_term_by($field, $value, $taxonomy, $output = OBJECT, $filter = 'raw') X-Ref |
| get_term_by() - Get all Term data from database by Term field and data. Warning: $value is not escaped for 'name' $field. You must do it yourself, if required. The default $field is 'id', therefore it is possible to also use null for field, but not recommended that you do so. If $value does not exist, the return value will be false. If $taxonomy exists and $field and $value combinations exist, the Term will be returned. param: string $field Either 'slug', 'name', or 'id' param: string|int $value Search for this term value param: string $taxonomy Taxonomy Name param: string $output Constant OBJECT, ARRAY_A, or ARRAY_N param: string $filter {@internal Missing Description}} return: mixed Term Row from database. Will return false if $taxonomy does not exist or $term was not found. |
| get_term_children( $term, $taxonomy ) X-Ref |
| get_term_children() - Merge all term children into a single array. This recursive function will merge all of the children of $term into the same array. Only useful for taxonomies which are hierarchical. Will return an empty array if $term does not exist in $taxonomy. param: string $term Name of Term to get children param: string $taxonomy Taxonomy Name return: array|WP_Error List of Term Objects. WP_Error returned if $taxonomy does not exist |
| get_term_field( $field, $term, $taxonomy, $context = 'display' ) X-Ref |
| get_term_field() - Get sanitized Term field Does checks for $term, based on the $taxonomy. The function is for contextual reasons and for simplicity of usage. @see sanitize_term_field() for more information. param: string $field Term field to fetch param: int $term Term ID param: string $taxonomy Taxonomy Name param: string $context {@internal Missing Description}} return: mixed Will return an empty string if $term is not an object or if $field is not set in $term. |
| get_term_to_edit( $id, $taxonomy ) X-Ref |
| get_term_to_edit() - Sanitizes Term for editing Return value is @see sanitize_term() and usage is for sanitizing the term for editing. Function is for contextual and simplicity. param: int|object $id Term ID or Object param: string $taxonomy Taxonomy Name return: mixed|null|WP_Error Will return empty string if $term is not an object. |
| get_terms($taxonomies, $args = '') X-Ref |
| get_terms() - Retrieve the terms in taxonomy or list of taxonomies. You can fully inject any customizations to the query before it is sent, as well as control the output with a filter. The 'get_terms' filter will be called when the cache has the term and will pass the found term along with the array of $taxonomies and array of $args. This filter is also called before the array of terms is passed and will pass the array of terms, along with the $taxonomies and $args. The 'list_terms_exclusions' filter passes the compiled exclusions along with the $args. The list that $args can contain, which will overwrite the defaults. orderby - Default is 'name'. Can be name, count, or nothing (will use term_id). order - Default is ASC. Can use DESC. hide_empty - Default is true. Will not return empty $terms. fields - Default is all. slug - Any terms that has this value. Default is empty string. hierarchical - Whether to return hierarchical taxonomy. Default is true. name__like - Default is empty string. The argument 'pad_counts' will count all of the children along with the $terms. The 'get' argument allows for overwriting 'hide_empty' and 'child_of', which can be done by setting the value to 'all', instead of its default empty string value. The 'child_of' argument will be used if you use multiple taxonomy or the first $taxonomy isn't hierarchical or 'parent' isn't used. The default is 0, which will be translated to a false value. If 'child_of' is set, then 'child_of' value will be tested against $taxonomy to see if 'child_of' is contained within. Will return an empty array if test fails. If 'parent' is set, then it will be used to test against the first taxonomy. Much like 'child_of'. Will return an empty array if the test fails. param: string|array Taxonomy name or list of Taxonomy names param: string|array $args The values of what to search for when returning terms return: array|WP_Error List of Term Objects and their children. Will return WP_Error, if any of $taxonomies do not exist. |
| is_term($term, $taxonomy = '') X-Ref |
| is_term() - Check if Term exists Returns the index of a defined term, or 0 (false) if the term doesn't exist. param: int|string $term The term to check param: string $taxonomy The taxonomy name to use return: mixed Get the term id or Term Object, if exists. |
| sanitize_term($term, $taxonomy, $context = 'display') X-Ref |
| sanitize_term() - Sanitize Term all fields Relys on @see sanitize_term_field() to sanitize the term. The difference is that this function will sanitize <strong>all</strong> fields. The context is based on @see sanitize_term_field(). The $term is expected to be either an array or an object. param: array|object $term The term to check param: string $taxonomy The taxonomy name to use param: string $context Default is 'display'. return: array|object Term with all fields sanitized |
| sanitize_term_field($field, $value, $term_id, $taxonomy, $context) X-Ref |
| sanitize_term_field() - {@internal Missing Short Description}} {@internal Missing Long Description}} param: string $field Term field to sanitize param: string $value Search for this term value param: int $term_id Term ID param: string $taxonomy Taxonomy Name param: string $context Either edit, db, display, attribute, or js. return: mixed sanitized field |
| wp_count_terms( $taxonomy, $args = array() X-Ref |
| wp_count_terms() - Count how many terms are in Taxonomy Default $args is 'ignore_empty' which can be <code>'ignore_empty=true'</code> or <code>array('ignore_empty' => true);</code>. param: string $taxonomy Taxonomy name param: array|string $args Overwrite defaults return: int How many terms are in $taxonomy |
| wp_delete_object_term_relationships( $object_id, $taxonomies ) X-Ref |
| wp_delete_object_term_relationships() - {@internal Missing Short Description}} {@internal Missing Long Description}} 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. |
| wp_delete_term( $term, $taxonomy, $args = array() X-Ref |
| wp_delete_term() - Removes a term from the database. {@internal Missing Long Description}} param: int $term Term ID param: string $taxonomy Taxonomy Name param: array|string $args Change Default return: bool Returns false if not term; true if completes delete action. |
| wp_get_object_terms($object_ids, $taxonomies, $args = array() X-Ref |
| wp_get_object_terms() - Returns the terms associated with the given object(s), in the supplied taxonomies. {@internal Missing Long Description}} 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. |
| wp_insert_term( $term, $taxonomy, $args = array() X-Ref |
| wp_insert_term() - Adds a new term to the database. Optionally marks it as an alias of an existing term. {@internal Missing Long Description}} param: int|string $term The term to add or update. param: string $taxonomy The taxonomy to which to add the term param: array|string $args Change the values of the inserted term return: array|WP_Error The Term ID and Term Taxonomy ID |
| wp_set_object_terms($object_id, $terms, $taxonomy, $append = false) X-Ref |
| wp_set_object_terms() - {@internal Missing Short Description}} 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). param: int $object_id The object to relate to. param: array|int|string $term The slug or id of the term. 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 |
| wp_unique_term_slug($slug, $term) X-Ref |
| wp_unique_term_slug() - Will make slug unique, if it isn't already The $slug has to be unique global to every taxonomy, meaning that one taxonomy term can't have a matching slug with another taxonomy term. Each slug has to be globally unique for every taxonomy. The way this works is that if the taxonomy that the term belongs to is heirarchical and has a parent, it will append that parent to the $slug. If that still doesn't return an unique slug, then it try to append a number until it finds a number that is truely unique. The only purpose for $term is for appending a parent, if one exists. param: string $slug The string that will be tried for a unique slug param: object $term The term object that the $slug will belong too return: string Will return a true unique slug. |
| wp_update_term( $term, $taxonomy, $args = array() X-Ref |
| wp_update_term() - {@internal Missing Short Description}} {@internal Missing Long Description}} param: int $term The ID of the term param: string $taxonomy The context in which to relate the term to the object. param: array|string $args Overwrite defaults return: array Returns Term ID and Taxonomy Term ID |
| wp_update_term_count( $terms, $taxonomy ) X-Ref |
| wp_update_term_count() - Updates the amount of terms in taxonomy If there is a taxonomy callback applyed, then it will be called for updating the count. The default action is to count what the amount of terms have the relationship of term ID. Once that is done, then update the database. param: int|array $terms The ID of the terms param: string $taxonomy The context of the term. return: bool If no terms will return false, and if successful will return true. |
| clean_object_term_cache($object_ids, $object_type) X-Ref |
| clean_object_term_cache() - {@internal Missing Short Description}} {@internal Missing Long Description}} param: int|array $object_ids {@internal Missing Description}} param: string $object_type {@internal Missing Description}} |
| clean_term_cache($ids, $taxonomy = '') X-Ref |
| clean_term_cache() - {@internal Missing Short Description}} {@internal Missing Long Description}} param: int|array $ids {@internal Missing Description}} param: string $taxonomy Can be empty and will assume tt_ids, else will use for context. |
| get_object_term_cache($id, $taxonomy) X-Ref |
| get_object_term_cache() - {@internal Missing Short Description}} {@internal Missing Long Description}} param: int|array $ids {@internal Missing Description}} param: string $taxonomy {@internal Missing Description}} return: bool|array Empty array if $terms found, but not $taxonomy. False if nothing is in cache for $taxonomy and $id. |
| update_object_term_cache($object_ids, $object_type) X-Ref |
| get_object_term_cache() - {@internal Missing Short Description}} {@internal Missing Long Description}} param: string|array $object_ids {@internal Missing Description}} param: string $object_type {@internal Missing Description}} return: null|array Null value is given with empty $object_ids. |
| update_term_cache($terms, $taxonomy = '') X-Ref |
| update_term_cache() - Updates Terms to Taxonomy in cache. param: array $terms List of Term objects to change param: string $taxonomy Optional. Update Term to this taxonomy in cache |
| _get_term_hierarchy($taxonomy) X-Ref |
| _get_term_hierarchy() - Retrieves children of taxonomy {@internal Missing Long Description}} param: string $taxonomy {@internal Missing Description}} return: array Empty if $taxonomy isn't hierarachical or returns children. |
| _get_term_children($term_id, $terms, $taxonomy) X-Ref |
| _get_term_children() - Get array of child terms If $terms is an array of objects, then objects will returned from the function. If $terms is an array of IDs, then an array of ids of children will be returned. param: int $term_id Look for this Term ID in $terms param: array $terms List of Term IDs param: string $taxonomy Term Context return: array Empty if $terms is empty else returns full list of child terms. |
| _pad_term_counts(&$terms, $taxonomy) X-Ref |
| _pad_term_counts() - Add count of children to parent count Recalculates term counts by including items from child terms. Assumes all relevant children are already in the $terms argument param: array $terms List of Term IDs param: string $taxonomy Term Context return: null Will break from function if conditions are not met. |
| _update_post_term_count( $terms ) X-Ref |
| _update_post_term_count() - Will update term count based on posts Private function for the default callback for post_tag and category taxonomies. param: array $terms List of Term IDs |
| Generated Thu Dec 6 06:47:08 2007 for RedAlt XRefs | Cross-referenced by PHPXref 0.6 and RedAlt |