Title: get_term
Published: April 25, 2014
Last modified: February 24, 2026

---

# get_term( int|WP_Term|object $term, string $taxonomy, string $output = OBJECT, string $filter ): 󠀁[WP_Term](https://developer.wordpress.org/reference/classes/wp_term/)󠁿|array|󠀁[WP_Error](https://developer.wordpress.org/reference/classes/wp_error/)󠁿|null

## In this article

 * [Description](https://developer.wordpress.org/reference/functions/get_term/?output_format=md#description)
    - [See also](https://developer.wordpress.org/reference/functions/get_term/?output_format=md#see-also)
 * [Parameters](https://developer.wordpress.org/reference/functions/get_term/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/get_term/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/get_term/?output_format=md#source)
 * [Hooks](https://developer.wordpress.org/reference/functions/get_term/?output_format=md#hooks)
 * [Related](https://developer.wordpress.org/reference/functions/get_term/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/get_term/?output_format=md#changelog)
 * [User Contributed Notes](https://developer.wordpress.org/reference/functions/get_term/?output_format=md#user-contributed-notes)

[ Back to top](https://developer.wordpress.org/reference/functions/get_term/?output_format=md#wp--skip-link--target)

Gets all term data from database by term ID.

## 󠀁[Description](https://developer.wordpress.org/reference/functions/get_term/?output_format=md#description)󠁿

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](https://developer.wordpress.org/reference/classes/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’](https://developer.wordpress.org/reference/hooks/get_term/) hook – Takes
two parameters the term Object and the taxonomy name.
Must return term object. Used
in [get_term()](https://developer.wordpress.org/reference/functions/get_term/) as
a catch-all filter for every $term.

[‘get_$taxonomy’](https://developer.wordpress.org/reference/hooks/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.

### 󠀁[See also](https://developer.wordpress.org/reference/functions/get_term/?output_format=md#see-also)󠁿

 * [sanitize_term_field()](https://developer.wordpress.org/reference/functions/sanitize_term_field/):
   The $context param lists the available values for [get_term_by()](https://developer.wordpress.org/reference/functions/get_term_by/)
   $filter param.

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/get_term/?output_format=md#parameters)󠁿

 `$term`int|[WP_Term](https://developer.wordpress.org/reference/classes/wp_term/)
|objectrequired

If integer, term data will be fetched from the database, or from the cache if available.

If stdClass object (as in the results of a database query), will apply filters and
return a `WP_Term` object with the `$term` data. If `WP_Term`, will return `$term`.

`$taxonomy`stringoptional

Taxonomy name that `$term` is part of.

`$output`stringoptional

The required return type. One of OBJECT, ARRAY_A, or ARRAY_N, which correspond to
a [WP_Term](https://developer.wordpress.org/reference/classes/wp_term/) object, 
an associative array, or a numeric array, respectively.

Default:`OBJECT`

`$filter`stringoptional

How to sanitize term fields. Default `'raw'`.

## 󠀁[Return](https://developer.wordpress.org/reference/functions/get_term/?output_format=md#return)󠁿

 [WP_Term](https://developer.wordpress.org/reference/classes/wp_term/)|array|[WP_Error](https://developer.wordpress.org/reference/classes/wp_error/)
|null [WP_Term](https://developer.wordpress.org/reference/classes/wp_term/) instance(
or array) on success, depending on the `$output` value.
 [WP_Error](https://developer.wordpress.org/reference/classes/wp_error/)
if `$taxonomy` does not exist. Null for miscellaneous failure.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/get_term/?output_format=md#source)󠁿

    ```php
    function get_term( $term, $taxonomy = '', $output = OBJECT, $filter = 'raw' ) {
    	if ( empty( $term ) ) {
    		return new WP_Error( 'invalid_term', __( 'Empty Term.' ) );
    	}

    	if ( $taxonomy && ! taxonomy_exists( $taxonomy ) ) {
    		return new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy.' ) );
    	}

    	if ( $term instanceof WP_Term ) {
    		$_term = $term;
    	} elseif ( is_object( $term ) ) {
    		if ( empty( $term->filter ) || 'raw' === $term->filter ) {
    			$_term = sanitize_term( $term, $taxonomy, 'raw' );
    			$_term = new WP_Term( $_term );
    		} else {
    			$_term = WP_Term::get_instance( $term->term_id );
    		}
    	} else {
    		$_term = WP_Term::get_instance( $term, $taxonomy );
    	}

    	if ( is_wp_error( $_term ) ) {
    		return $_term;
    	} elseif ( ! $_term ) {
    		return null;
    	}

    	// Ensure for filters that this is not empty.
    	$taxonomy = $_term->taxonomy;

    	$old_term = $_term;
    	/**
    	 * Filters a taxonomy term object.
    	 *
    	 * The 'get_$taxonomy' hook is also available for targeting a specific
    	 * taxonomy.
    	 *
    	 * @since 2.3.0
    	 * @since 4.4.0 `$_term` is now a `WP_Term` object.
    	 *
    	 * @param WP_Term $_term    Term object.
    	 * @param string  $taxonomy The taxonomy slug.
    	 */
    	$_term = apply_filters( 'get_term', $_term, $taxonomy );

    	/**
    	 * Filters a taxonomy term object.
    	 *
    	 * The dynamic portion of the hook name, `$taxonomy`, refers
    	 * to the slug of the term's taxonomy.
    	 *
    	 * Possible hook names include:
    	 *
    	 *  - `get_category`
    	 *  - `get_post_tag`
    	 *
    	 * @since 2.3.0
    	 * @since 4.4.0 `$_term` is now a `WP_Term` object.
    	 *
    	 * @param WP_Term $_term    Term object.
    	 * @param string  $taxonomy The taxonomy slug.
    	 */
    	$_term = apply_filters( "get_{$taxonomy}", $_term, $taxonomy );

    	// Bail if a filter callback has changed the type of the `$_term` object.
    	if ( ! ( $_term instanceof WP_Term ) ) {
    		return $_term;
    	}

    	// Sanitize term, according to the specified filter.
    	if ( $_term !== $old_term || $_term->filter !== $filter ) {
    		$_term->filter( $filter );
    	}

    	if ( ARRAY_A === $output ) {
    		return $_term->to_array();
    	} elseif ( ARRAY_N === $output ) {
    		return array_values( $_term->to_array() );
    	}

    	return $_term;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/taxonomy.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/taxonomy.php#L977)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/taxonomy.php#L977-L1059)

## 󠀁[Hooks](https://developer.wordpress.org/reference/functions/get_term/?output_format=md#hooks)󠁿

 [apply_filters( ‘get_term’, WP_Term $_term, string $taxonomy )](https://developer.wordpress.org/reference/hooks/get_term/)

Filters a taxonomy term object.

 [apply_filters( “get_{$taxonomy}”, WP_Term $_term, string $taxonomy )](https://developer.wordpress.org/reference/hooks/get_taxonomy/)

Filters a taxonomy term object.

## 󠀁[Related](https://developer.wordpress.org/reference/functions/get_term/?output_format=md#related)󠁿

| Uses | Description | 
| [WP_Term::__construct()](https://developer.wordpress.org/reference/classes/wp_term/__construct/)`wp-includes/class-wp-term.php` |

Constructor.

  | 
| [WP_Term::get_instance()](https://developer.wordpress.org/reference/classes/wp_term/get_instance/)`wp-includes/class-wp-term.php` |

Retrieve [WP_Term](https://developer.wordpress.org/reference/classes/wp_term/) instance.

  | 
| [sanitize_term()](https://developer.wordpress.org/reference/functions/sanitize_term/)`wp-includes/taxonomy.php` |

Sanitizes all term fields.

  | 
| [taxonomy_exists()](https://developer.wordpress.org/reference/functions/taxonomy_exists/)`wp-includes/taxonomy.php` |

Determines whether the taxonomy name exists.

  | 
| [__()](https://developer.wordpress.org/reference/functions/__/)`wp-includes/l10n.php` |

Retrieves the translation of $text.

  | 
| [apply_filters()](https://developer.wordpress.org/reference/functions/apply_filters/)`wp-includes/plugin.php` |

Calls the callback functions that have been added to a filter hook.

  | 
| [is_wp_error()](https://developer.wordpress.org/reference/functions/is_wp_error/)`wp-includes/load.php` |

Checks whether the given variable is a WordPress Error.

  | 
| [WP_Error::__construct()](https://developer.wordpress.org/reference/classes/wp_error/__construct/)`wp-includes/class-wp-error.php` |

Initializes the error.

  |

[Show 4 more](https://developer.wordpress.org/reference/functions/get_term/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/get_term/?output_format=md#)

| Used by | Description | 
| [_block_bindings_term_data_get_value()](https://developer.wordpress.org/reference/functions/_block_bindings_term_data_get_value/)`wp-includes/block-bindings/term-data.php` |

Gets value for Term Data source.

  | 
| [is_term_publicly_viewable()](https://developer.wordpress.org/reference/functions/is_term_publicly_viewable/)`wp-includes/taxonomy.php` |

Determines whether a term is publicly viewable.

  | 
| [WP_REST_Menu_Items_Controller::prepare_item_for_database()](https://developer.wordpress.org/reference/classes/wp_rest_menu_items_controller/prepare_item_for_database/)`wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php` |

Prepares a single nav menu item for create or update.

  | 
| [WP_REST_Menus_Controller::update_item()](https://developer.wordpress.org/reference/classes/wp_rest_menus_controller/update_item/)`wp-includes/rest-api/endpoints/class-wp-rest-menus-controller.php` |

Updates a single term from a taxonomy.

  | 
| [WP_REST_Term_Search_Handler::prepare_item()](https://developer.wordpress.org/reference/classes/wp_rest_term_search_handler/prepare_item/)`wp-includes/rest-api/search/class-wp-rest-term-search-handler.php` |

Prepares the search result for a given term ID.

  | 
| [WP_REST_Term_Search_Handler::prepare_item_links()](https://developer.wordpress.org/reference/classes/wp_rest_term_search_handler/prepare_item_links/)`wp-includes/rest-api/search/class-wp-rest-term-search-handler.php` |

Prepares links for the search result of a given ID.

  | 
| [rest_get_route_for_term()](https://developer.wordpress.org/reference/functions/rest_get_route_for_term/)`wp-includes/rest-api.php` |

Gets the REST API route for a term.

  | 
| [get_object_subtype()](https://developer.wordpress.org/reference/functions/get_object_subtype/)`wp-includes/meta.php` |

Returns the object subtype for a given object ID of a specific type.

  | 
| [WP_Term_Query::populate_terms()](https://developer.wordpress.org/reference/classes/wp_term_query/populate_terms/)`wp-includes/class-wp-term-query.php` |

Creates an array of term objects from an array of term IDs.

  | 
| [get_term_parents_list()](https://developer.wordpress.org/reference/functions/get_term_parents_list/)`wp-includes/category-template.php` |

Retrieves term parents with separator.

  | 
| [WP_REST_Terms_Controller::get_term()](https://developer.wordpress.org/reference/classes/wp_rest_terms_controller/get_term/)`wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php` |

Get the term, if the ID is valid.

  | 
| [WP_REST_Terms_Controller::prepare_links()](https://developer.wordpress.org/reference/classes/wp_rest_terms_controller/prepare_links/)`wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php` |

Prepares links for the request.

  | 
| [WP_REST_Terms_Controller::prepare_item_for_database()](https://developer.wordpress.org/reference/classes/wp_rest_terms_controller/prepare_item_for_database/)`wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php` |

Prepares a single term for create or update.

  | 
| [WP_REST_Terms_Controller::create_item()](https://developer.wordpress.org/reference/classes/wp_rest_terms_controller/create_item/)`wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php` |

Creates a single term in a taxonomy.

  | 
| [WP_REST_Terms_Controller::update_item()](https://developer.wordpress.org/reference/classes/wp_rest_terms_controller/update_item/)`wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php` |

Updates a single term from a taxonomy.

  | 
| [WP_REST_Posts_Controller::check_assign_terms_permission()](https://developer.wordpress.org/reference/classes/wp_rest_posts_controller/check_assign_terms_permission/)`wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php` |

Checks whether current user can assign all terms sent with the current request.

  | 
| [WP_Term_Query::get_terms()](https://developer.wordpress.org/reference/classes/wp_term_query/get_terms/)`wp-includes/class-wp-term-query.php` |

Retrieves the query results.

  | 
| [WP_Links_List_Table::column_categories()](https://developer.wordpress.org/reference/classes/wp_links_list_table/column_categories/)`wp-admin/includes/class-wp-links-list-table.php` |

Handles the link categories column output.

  | 
| [export_wp()](https://developer.wordpress.org/reference/functions/export_wp/)`wp-admin/includes/export.php` |

Generates the WXR export file for download.

  | 
| [get_category_to_edit()](https://developer.wordpress.org/reference/functions/get_category_to_edit/)`wp-admin/includes/taxonomy.php` |

Gets category object for given ID and ‘edit’ filter context.

  | 
| [wp_update_category()](https://developer.wordpress.org/reference/functions/wp_update_category/)`wp-admin/includes/taxonomy.php` |

Aliases [wp_insert_category()](https://developer.wordpress.org/reference/functions/wp_insert_category/) with minimal args.

  | 
| [wp_terms_checklist()](https://developer.wordpress.org/reference/functions/wp_terms_checklist/)`wp-admin/includes/template.php` |

Outputs an unordered list of checkbox input elements labelled with term names.

  | 
| [wp_ajax_add_menu_item()](https://developer.wordpress.org/reference/functions/wp_ajax_add_menu_item/)`wp-admin/includes/ajax-actions.php` |

Handles adding a menu item via AJAX.

  | 
| [wp_ajax_inline_save_tax()](https://developer.wordpress.org/reference/functions/wp_ajax_inline_save_tax/)`wp-admin/includes/ajax-actions.php` |

Handles Quick Edit saving for a term via AJAX.

  | 
| [_wp_ajax_add_hierarchical_term()](https://developer.wordpress.org/reference/functions/_wp_ajax_add_hierarchical_term/)`wp-admin/includes/ajax-actions.php` |

Handles adding a hierarchical term via AJAX.

  | 
| [wp_ajax_delete_tag()](https://developer.wordpress.org/reference/functions/wp_ajax_delete_tag/)`wp-admin/includes/ajax-actions.php` |

Handles deleting a tag via AJAX.

  | 
| [wp_ajax_add_tag()](https://developer.wordpress.org/reference/functions/wp_ajax_add_tag/)`wp-admin/includes/ajax-actions.php` |

Handles adding a tag via AJAX.

  | 
| [WP_Terms_List_Table::column_name()](https://developer.wordpress.org/reference/classes/wp_terms_list_table/column_name/)`wp-admin/includes/class-wp-terms-list-table.php` |  | 
| [WP_Terms_List_Table::_rows()](https://developer.wordpress.org/reference/classes/wp_terms_list_table/_rows/)`wp-admin/includes/class-wp-terms-list-table.php` |  | 
| [Walker_Nav_Menu_Edit::start_el()](https://developer.wordpress.org/reference/classes/walker_nav_menu_edit/start_el/)`wp-admin/includes/class-walker-nav-menu-edit.php` |

Start the element output.

  | 
| [_wp_ajax_menu_quick_search()](https://developer.wordpress.org/reference/functions/_wp_ajax_menu_quick_search/)`wp-admin/includes/nav-menu.php` |

Prints the appropriate response to a menu quick search.

  | 
| [map_meta_cap()](https://developer.wordpress.org/reference/functions/map_meta_cap/)`wp-includes/capabilities.php` |

Maps a capability to the primitive capabilities required of the given user to satisfy the capability being checked.

  | 
| [Walker_Category::start_el()](https://developer.wordpress.org/reference/classes/walker_category/start_el/)`wp-includes/class-walker-category.php` |

Starts the element output.

  | 
| [get_the_category_by_ID()](https://developer.wordpress.org/reference/functions/get_the_category_by_id/)`wp-includes/category-template.php` |

Retrieves category name based on category ID.

  | 
| [WP_Query::get_queried_object()](https://developer.wordpress.org/reference/classes/wp_query/get_queried_object/)`wp-includes/class-wp-query.php` |

Retrieves the currently queried object.

  | 
| [get_cat_name()](https://developer.wordpress.org/reference/functions/get_cat_name/)`wp-includes/category.php` |

Retrieves the name of a category from its ID.

  | 
| [get_tag()](https://developer.wordpress.org/reference/functions/get_tag/)`wp-includes/category.php` |

Retrieves a post tag by tag ID or tag object.

  | 
| [get_category()](https://developer.wordpress.org/reference/functions/get_category/)`wp-includes/category.php` |

Retrieves category data given a category ID or category object.

  | 
| [get_category_by_path()](https://developer.wordpress.org/reference/functions/get_category_by_path/)`wp-includes/category.php` |

Retrieves a category based on URL containing the category slug.

  | 
| [wp_get_term_taxonomy_parent_id()](https://developer.wordpress.org/reference/functions/wp_get_term_taxonomy_parent_id/)`wp-includes/taxonomy.php` |

Returns the term’s parent’s term ID.

  | 
| [get_object_term_cache()](https://developer.wordpress.org/reference/functions/get_object_term_cache/)`wp-includes/taxonomy.php` |

Retrieves the cached term objects for the given object ID.

  | 
| [_get_term_children()](https://developer.wordpress.org/reference/functions/_get_term_children/)`wp-includes/taxonomy.php` |

Gets the subset of $terms that are descendants of $term_id.

  | 
| [get_term_link()](https://developer.wordpress.org/reference/functions/get_term_link/)`wp-includes/taxonomy.php` |

Generates a permalink for a taxonomy term archive.

  | 
| [get_ancestors()](https://developer.wordpress.org/reference/functions/get_ancestors/)`wp-includes/taxonomy.php` |

Gets an array of ancestor IDs for a given object.

  | 
| [wp_unique_term_slug()](https://developer.wordpress.org/reference/functions/wp_unique_term_slug/)`wp-includes/taxonomy.php` |

Makes term slug unique, if it isn’t already.

  | 
| [wp_update_term()](https://developer.wordpress.org/reference/functions/wp_update_term/)`wp-includes/taxonomy.php` |

Updates term based on arguments provided.

  | 
| [wp_delete_term()](https://developer.wordpress.org/reference/functions/wp_delete_term/)`wp-includes/taxonomy.php` |

Removes a term from the database.

  | 
| [get_term_by()](https://developer.wordpress.org/reference/functions/get_term_by/)`wp-includes/taxonomy.php` |

Gets all term data from database by term field and data.

  | 
| [get_term_field()](https://developer.wordpress.org/reference/functions/get_term_field/)`wp-includes/taxonomy.php` |

Gets sanitized term field.

  | 
| [get_term_to_edit()](https://developer.wordpress.org/reference/functions/get_term_to_edit/)`wp-includes/taxonomy.php` |

Sanitizes term for editing.

  | 
| [term_is_ancestor_of()](https://developer.wordpress.org/reference/functions/term_is_ancestor_of/)`wp-includes/taxonomy.php` |

Checks if a term is an ancestor of another term.

  | 
| [get_term_feed_link()](https://developer.wordpress.org/reference/functions/get_term_feed_link/)`wp-includes/link-template.php` |

Retrieves the feed link for a term.

  | 
| [get_edit_term_link()](https://developer.wordpress.org/reference/functions/get_edit_term_link/)`wp-includes/link-template.php` |

Retrieves the URL for editing a given term.

  | 
| [edit_term_link()](https://developer.wordpress.org/reference/functions/edit_term_link/)`wp-includes/link-template.php` |

Displays or retrieves the edit term link with formatting.

  | 
| [get_permalink()](https://developer.wordpress.org/reference/functions/get_permalink/)`wp-includes/link-template.php` |

Retrieves the full permalink for the current post or post ID.

  | 
| [wp_setup_nav_menu_item()](https://developer.wordpress.org/reference/functions/wp_setup_nav_menu_item/)`wp-includes/nav-menu.php` |

Decorates a menu item object with the shared navigation menu item properties.

  | 
| [wp_update_nav_menu_item()](https://developer.wordpress.org/reference/functions/wp_update_nav_menu_item/)`wp-includes/nav-menu.php` |

Saves the properties of a menu item or create a new one.

  | 
| [wp_get_nav_menu_object()](https://developer.wordpress.org/reference/functions/wp_get_nav_menu_object/)`wp-includes/nav-menu.php` |

Returns a navigation menu object.

  | 
| [wp_xmlrpc_server::wp_newTerm()](https://developer.wordpress.org/reference/classes/wp_xmlrpc_server/wp_newterm/)`wp-includes/class-wp-xmlrpc-server.php` |

Creates a new term.

  | 
| [wp_xmlrpc_server::wp_editTerm()](https://developer.wordpress.org/reference/classes/wp_xmlrpc_server/wp_editterm/)`wp-includes/class-wp-xmlrpc-server.php` |

Edits a term.

  | 
| [wp_xmlrpc_server::wp_deleteTerm()](https://developer.wordpress.org/reference/classes/wp_xmlrpc_server/wp_deleteterm/)`wp-includes/class-wp-xmlrpc-server.php` |

Deletes a term.

  | 
| [wp_xmlrpc_server::wp_getTerm()](https://developer.wordpress.org/reference/classes/wp_xmlrpc_server/wp_getterm/)`wp-includes/class-wp-xmlrpc-server.php` |

Retrieves a term.

  |

[Show 57 more](https://developer.wordpress.org/reference/functions/get_term/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/get_term/?output_format=md#)

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/get_term/?output_format=md#changelog)󠁿

| Version | Description | 
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Converted to return a [WP_Term](https://developer.wordpress.org/reference/classes/wp_term/) object if `$output` is `OBJECT`.
 The `$taxonomy` parameter was made optional. | 
| [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |

## 󠀁[User Contributed Notes](https://developer.wordpress.org/reference/functions/get_term/?output_format=md#user-contributed-notes)󠁿

 1.   [Skip to note 3 content](https://developer.wordpress.org/reference/functions/get_term/?output_format=md#comment-content-429)
 2.    [Codex](https://profiles.wordpress.org/codex/)  [  11 years ago  ](https://developer.wordpress.org/reference/functions/get_term/#comment-429)
 3.  [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_term%2F%23comment-429)
     Vote results for this note: 2[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_term%2F%23comment-429)
 4.  **Examples**
      Get Term offers some handy information, but unfortunately lacks 
     a link value.
 5.      ```php
         $term = get_term( $term_id, $taxonomy );
         ```
     
 6.  Gives you term slug: e.g.: term-slug-example
 7.      ```php
         $slug = $term->slug;
         ```
     
 8.  Gives you term name: e.g. Term Name Example
 9.      ```php
         $name = $term->name;
         ```
     
 10. Gives you term description: e.g. This is my new cool custom term.
 11.     ```php
         $desc = $term->description;
         ```
     
 12.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_term%2F%3Freplytocom%3D429%23feedback-editor-429)
 13.  [Skip to note 4 content](https://developer.wordpress.org/reference/functions/get_term/?output_format=md#comment-content-862)
 14.   [Lance Cleveland](https://profiles.wordpress.org/charlestonsw/)  [  11 years ago  ](https://developer.wordpress.org/reference/functions/get_term/#comment-862)
 15. [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_term%2F%23comment-862)
     Vote results for this note: 2[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_term%2F%23comment-862)
 16. `get_term()` utilizes the WP Object Cache to store previously-fetched term data.
     This helps avoid subsequent data I/O calls from the database to read term data.
     For example:
 17.     ```php
         $term = get_term( 1 , 'store' );
         echo $term->name;
         $term = get_term( 1 , ' store' );
         echo $term->slug;
         ```
     
 18. This overly-simple example will only perform a single select query on the database.
     The second get_term will use the WP Object Cache to fetch the previous term object
     from memory.
 19.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_term%2F%3Freplytocom%3D862%23feedback-editor-862)

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_term%2F)
before being able to contribute a note or feedback.